File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
code/addons/vitest/src/node Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -164,9 +164,20 @@ export class VitestManager {
164164 }
165165
166166 private updateLastChanged ( filepath : string ) {
167- this . vitest ! . projects . forEach ( ( project ) => {
168- const mods = project . vite . moduleGraph . getModulesByFile ( filepath ) ;
169- mods ?. forEach ( ( mod ) => project . vite . moduleGraph . invalidateModule ( mod ) ) ;
167+ // @ts -expect-error `server` only exists in Vitest 3
168+ this . vitest ! . projects . forEach ( ( { browser, vite, server } ) => {
169+ if ( server ) {
170+ const serverMods = server . moduleGraph . getModulesByFile ( filepath ) ;
171+ serverMods ?. forEach ( ( mod : any ) => server . moduleGraph . invalidateModule ( mod ) ) ;
172+ }
173+ if ( vite ) {
174+ const serverMods = vite . moduleGraph . getModulesByFile ( filepath ) ;
175+ serverMods ?. forEach ( ( mod ) => vite . moduleGraph . invalidateModule ( mod ) ) ;
176+ }
177+ if ( browser ) {
178+ const browserMods = browser . vite . moduleGraph . getModulesByFile ( filepath ) ;
179+ browserMods ?. forEach ( ( mod ) => browser . vite . moduleGraph . invalidateModule ( mod ) ) ;
180+ }
170181 } ) ;
171182 }
172183
You can’t perform that action at this time.
0 commit comments