Skip to content

Commit

Permalink
feat: expose process.env.VITEST_MODE
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Mar 17, 2022
1 parent 01bdef7 commit 6647fa7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/vitest/src/node/cli-api.ts
Expand Up @@ -15,10 +15,6 @@ export interface CliOptions extends UserConfig {
}

export async function startVitest(cliFilters: string[], options: CliOptions, viteOverrides?: ViteUserConfig) {
process.env.TEST = 'true'
process.env.VITEST = 'true'
process.env.NODE_ENV ??= options.mode || 'test'

if (options.run)
options.watch = false

Expand All @@ -27,6 +23,11 @@ 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 }

Expand Down

0 comments on commit 6647fa7

Please sign in to comment.