Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.

Commit cad8f5a

Browse files
committed
fix(test-utils): handle vitest v0.20
1 parent 9c9e20e commit cad8f5a

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/test-utils/src/run.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,30 @@ export async function runTests (opts: RunTestOptions) {
2121
process.env.NUXT_TEST_DEV = 'true'
2222
}
2323

24+
// TODO: add `as typeof import('vitest/dist/node')` and remove workaround
25+
// when we upgrade vitest: see https://github.com/nuxt/framework/issues/6297
26+
2427
// @ts-ignore missing types
2528
const { startVitest } = await import('vitest/dist/node.mjs')
26-
const succeeded = await startVitest(
29+
const args: any[] = [
2730
[] /* argv */,
2831
// Vitest options
2932
{
3033
root: opts.rootDir,
31-
run: !opts.watch
34+
run: !opts.watch,
35+
deps: {
36+
inline: [/@nuxt\/test-utils/]
37+
}
3238
},
3339
// Vite options
3440
{
3541
esbuild: {
3642
tsconfigRaw: '{}'
3743
}
3844
}
39-
)
45+
]
46+
if (startVitest.length >= 4) { args.unshift('test') }
47+
const succeeded = await startVitest(...args)
4048

4149
if (!succeeded) {
4250
process.exit(1)

0 commit comments

Comments
 (0)