Skip to content

Commit 16930b4

Browse files
committedDec 6, 2024··
test: await file snapshot assertions
1 parent b2b4a90 commit 16930b4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎test/build.spec.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ describe('module builder', () => {
118118

119119
it('should generate typed plugin', async () => {
120120
const pluginDts = await readFile(join(distDir, 'runtime/plugins/plugin.d.ts'), 'utf-8')
121-
expect(pluginDts).toMatchFileSnapshot('__snapshots__/plugin.d.ts')
121+
await expect(pluginDts).toMatchFileSnapshot('__snapshots__/plugin.d.ts')
122122
})
123123

124124
it('should correctly add extensions to imports from runtime/ directory', async () => {
@@ -130,20 +130,20 @@ describe('module builder', () => {
130130
// TODO: https://github.com/nuxt/module-builder/issues/239
131131
it('should generate components correctly', async () => {
132132
const componentFile = await readFile(join(distDir, 'runtime/components/TestMe.vue'), 'utf-8')
133-
expect(componentFile.replace(/\r\n/g, '\n')).toMatchFileSnapshot('__snapshots__/TestMe.vue')
133+
await expect(componentFile.replace(/\r\n/g, '\n')).toMatchFileSnapshot('__snapshots__/TestMe.vue')
134134
})
135135

136136
it('should generate wrapped composables', async () => {
137137
const componentFile = await readFile(join(distDir, 'runtime/composables/useWrappedFetch.d.ts'), 'utf-8')
138-
expect(componentFile).toMatchFileSnapshot('__snapshots__/useWrappedFetch.d.ts')
138+
await expect(componentFile).toMatchFileSnapshot('__snapshots__/useWrappedFetch.d.ts')
139139
})
140140

141141
it('should handle JSX correctly', async () => {
142142
const [component, declaration] = await Promise.all([
143143
readFile(join(distDir, 'runtime/components/JsxComponent.js'), 'utf-8'),
144144
readFile(join(distDir, 'runtime/components/JsxComponent.d.ts'), 'utf-8'),
145145
])
146-
expect(component).toMatchFileSnapshot('__snapshots__/JsxComponent.js')
147-
expect(declaration).toMatchFileSnapshot('__snapshots__/JsxComponent.d.ts')
146+
await expect(component).toMatchFileSnapshot('__snapshots__/JsxComponent.js')
147+
await expect(declaration).toMatchFileSnapshot('__snapshots__/JsxComponent.d.ts')
148148
})
149149
})

0 commit comments

Comments
 (0)
Please sign in to comment.