mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
fix(test-utils): support vitest v0.20.x (#7712)
This commit is contained in:
parent
a9a8571e35
commit
0640a6c7a4
@ -21,14 +21,20 @@ export async function runTests (opts: RunTestOptions) {
|
|||||||
process.env.NUXT_TEST_DEV = 'true'
|
process.env.NUXT_TEST_DEV = 'true'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: add `as typeof import('vitest/dist/node')` and remove workaround
|
||||||
|
// when we upgrade vitest: see https://github.com/nuxt/framework/issues/6297
|
||||||
|
|
||||||
// @ts-ignore missing types
|
// @ts-ignore missing types
|
||||||
const { startVitest } = await import('vitest/dist/node.mjs')
|
const { startVitest } = await import('vitest/dist/node.mjs')
|
||||||
const succeeded = await startVitest(
|
const args: any[] = [
|
||||||
[] /* argv */,
|
[] /* argv */,
|
||||||
// Vitest options
|
// Vitest options
|
||||||
{
|
{
|
||||||
root: opts.rootDir,
|
root: opts.rootDir,
|
||||||
run: !opts.watch
|
run: !opts.watch,
|
||||||
|
deps: {
|
||||||
|
inline: [/@nuxt\/test-utils/]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// Vite options
|
// Vite options
|
||||||
{
|
{
|
||||||
@ -36,7 +42,9 @@ export async function runTests (opts: RunTestOptions) {
|
|||||||
tsconfigRaw: '{}'
|
tsconfigRaw: '{}'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
]
|
||||||
|
if (startVitest.length >= 4) { args.unshift('test') }
|
||||||
|
const succeeded = await startVitest(...args)
|
||||||
|
|
||||||
if (!succeeded) {
|
if (!succeeded) {
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user