Skip to content

Commit

Permalink
fix: process.env.VITEST_MODE timing
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Mar 17, 2022
1 parent 9176794 commit 2254c91
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/vitest/src/node/cli-api.ts
Expand Up @@ -23,16 +23,16 @@ export async function startVitest(cliFilters: string[], options: CliOptions, vit
return false
}

process.env.TEST = 'true'
process.env.VITEST = 'true'
process.env.VITEST_MODE = options.watch ? 'WATCH' : 'RUN'
process.env.NODE_ENV ??= options.mode || 'test'

if (typeof options.coverage === 'boolean')
options.coverage = { enabled: options.coverage }

const ctx = await createVitest(options, viteOverrides)

process.env.TEST = 'true'
process.env.VITEST = 'true'
process.env.VITEST_MODE = ctx.config.watch ? 'WATCH' : 'RUN'
process.env.NODE_ENV ??= ctx.config.mode || 'test'

if (ctx.config.coverage.enabled) {
if (!await ensurePackageInstalled('c8')) {
process.exitCode = 1
Expand Down

0 comments on commit 2254c91

Please sign in to comment.