Skip to content

Commit

Permalink
fix: allow set watch: false in config, close #724
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Feb 10, 2022
1 parent 810cf82 commit 6772c5f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/vitest/src/node/plugins/index.ts
Expand Up @@ -29,7 +29,7 @@ export async function VitestPlugin(options: UserConfig = {}, ctx = new Vitest())

return {
// we are setting NODE_ENV when running CLI to 'test',
// but it can be overriden
// but it can be overridden
mode: viteConfig.mode || process.env.NODE_ENV || 'test',
clearScreen: false,
resolve: {
Expand All @@ -49,11 +49,15 @@ export async function VitestPlugin(options: UserConfig = {}, ctx = new Vitest())
}
},
async configResolved(viteConfig) {
const viteConfigTest = (viteConfig.test as any) || {}
if (viteConfigTest.watch === false)
viteConfigTest.run = true

// viteConfig.test is final now, merge it for real
options = deepMerge(
{},
configDefaults,
(viteConfig.test as any) || {},
viteConfigTest,
options,
)
options.api = resolveApiConfig(options)
Expand Down

0 comments on commit 6772c5f

Please sign in to comment.