refactor(test-utils)!: update vitest args (#8325)

This commit is contained in:
Daniel Roe 2022-10-19 14:10:51 +01:00 committed by GitHub
parent d82d145a0b
commit 654ddd412a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,12 +21,10 @@ 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') as typeof import('vitest/dist/node')
const args: any[] = [ const succeeded = await startVitest(
'test',
[] /* argv */, [] /* argv */,
// Vitest options // Vitest options
{ {
@ -42,9 +40,7 @@ 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)