Skip to content

Commit

Permalink
fix: dev mode resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Feb 22, 2022
1 parent 3b5371c commit 66551f8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/vitest/src/node/cli.ts
Expand Up @@ -65,6 +65,6 @@ async function run(cliFilters: string[], options: CliOptions) {
}

async function start(cliFilters: string[], options: CliOptions) {
await startVitest(cliFilters, options)
process.exit()
if (await startVitest(cliFilters, options) === false)
process.exit()
}
9 changes: 5 additions & 4 deletions packages/vitest/src/node/cliApi.ts
Expand Up @@ -22,7 +22,7 @@ export async function startVitest(cliFilters: string[], options: CliOptions, vit

if (!await ensurePackageInstalled('vite')) {
process.exitCode = 1
return
return false
}

if (typeof options.coverage === 'boolean')
Expand All @@ -33,21 +33,21 @@ export async function startVitest(cliFilters: string[], options: CliOptions, vit
if (ctx.config.coverage.enabled) {
if (!await ensurePackageInstalled('c8')) {
process.exitCode = 1
return
return false
}

if (!process.env.NODE_V8_COVERAGE) {
process.env.NODE_V8_COVERAGE = ctx.config.coverage.tempDirectory
const { exitCode } = await execa(process.argv0, process.argv.slice(1), { stdio: 'inherit', reject: false })
process.exitCode = exitCode
return
return false
}
}

if (ctx.config.environment && ctx.config.environment !== 'node') {
if (!await ensurePackageInstalled(ctx.config.environment)) {
process.exitCode = 1
return
return false
}
}

Expand All @@ -72,4 +72,5 @@ export async function startVitest(cliFilters: string[], options: CliOptions, vit
if (!ctx.config.watch)
await ctx.exit()
}
return true
}

0 comments on commit 66551f8

Please sign in to comment.