Skip to content

Commit

Permalink
fix(cli): do not enable watch if it wasn't enabled before
Browse files Browse the repository at this point in the history
  • Loading branch information
DerYeger committed Feb 9, 2022
1 parent 1021c7c commit e2b2f02
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/vitest/src/constants.ts
Expand Up @@ -50,7 +50,7 @@ export const configDefaults: UserConfig = Object.freeze({
watchIgnore: [/\/node_modules\//, /\/dist\//],
update: false,
run: !!process.env.CI,
watch: false,
watch: !process.env.CI,
reporters: 'default',
silent: false,
api: false,
Expand Down
6 changes: 1 addition & 5 deletions packages/vitest/src/node/cli.ts
Expand Up @@ -35,7 +35,7 @@ cli

cli
.command('run [...filters]')
.action(runInRunMode)
.action((cliFilters: string[], argv: UserConfig) => run(cliFilters, { ...argv, run: true, watch: false }))

cli
.command('related [...filters]')
Expand All @@ -55,10 +55,6 @@ cli

cli.parse()

async function runInRunMode(cliFilters: string[], argv: UserConfig) {
await run(cliFilters, { ...argv, run: true })
}

async function runRelated(relatedFiles: string[] | string, argv: UserConfig) {
argv.related = relatedFiles
argv.passWithNoTests ??= true
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/node/plugins/index.ts
Expand Up @@ -56,7 +56,7 @@ export async function VitestPlugin(options: UserConfig = {}, ctx = new Vitest())
options,
)
options.api = resolveApiConfig(options)
options.watch = !options.run
options.watch &&= !options.run
},
async configureServer(server) {
if (haveStarted)
Expand Down

0 comments on commit e2b2f02

Please sign in to comment.