File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ export class Vitest {
6262 this . restartsCount += 1
6363 this . pool ?. close ( )
6464 this . pool = undefined
65+ this . coverageProvider = undefined
66+ this . runningPromise = undefined
6567
6668 const resolved = resolveConfig ( this . mode , options , server . config )
6769
@@ -110,8 +112,6 @@ export class Vitest {
110112 ? await createBenchmarkReporters ( toArray ( resolved . benchmark ?. reporters ) , this . runner )
111113 : await createReporters ( resolved . reporters , this . runner )
112114
113- this . runningPromise = undefined
114-
115115 this . cache . results . setConfig ( resolved . root , resolved . cache )
116116 try {
117117 await this . cache . results . readFromCache ( )
Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ import { CSSEnablerPlugin } from './cssEnabler'
1414import { CoverageTransform } from './coverageTransform'
1515
1616export async function VitestPlugin ( options : UserConfig = { } , ctx = new Vitest ( 'test' ) ) : Promise < VitePlugin [ ] > {
17+ const userConfig = deepMerge ( { } , options ) as UserConfig
18+
1719 const getRoot = ( ) => ctx . config ?. root || options . root || process . cwd ( )
1820
1921 async function UIPlugin ( ) {
@@ -34,6 +36,12 @@ export async function VitestPlugin(options: UserConfig = {}, ctx = new Vitest('t
3436 this . meta . watchMode = false
3537 } ,
3638 async config ( viteConfig : any ) {
39+ if ( options . watch ) {
40+ // Earlier runs have overwritten values of the `options`.
41+ // Reset it back to initial user config before setting up the server again.
42+ options = deepMerge ( { } , userConfig ) as UserConfig
43+ }
44+
3745 // preliminary merge of options to be able to create server options for vite
3846 // however to allow vitest plugins to modify vitest config values
3947 // this is repeated in configResolved where the config is final
You can’t perform that action at this time.
0 commit comments