File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -403,9 +403,6 @@ export class Vitest {
403
403
404
404
private _rerunTimer : any
405
405
private async scheduleRerun ( triggerId : string ) {
406
- const mod = this . server . moduleGraph . getModuleById ( triggerId )
407
- if ( mod )
408
- mod . lastHMRTimestamp = Date . now ( )
409
406
const currentCount = this . restartsCount
410
407
clearTimeout ( this . _rerunTimer )
411
408
await this . runningPromise
@@ -447,8 +444,15 @@ export class Vitest {
447
444
448
445
private unregisterWatcher = noop
449
446
private registerWatcher ( ) {
447
+ const updateLastChanged = ( id : string ) => {
448
+ const mod = this . server . moduleGraph . getModuleById ( id )
449
+ if ( mod )
450
+ mod . lastHMRTimestamp = Date . now ( )
451
+ }
452
+
450
453
const onChange = ( id : string ) => {
451
454
id = slash ( id )
455
+ updateLastChanged ( id )
452
456
const needsRerun = this . handleFileChanged ( id )
453
457
if ( needsRerun )
454
458
this . scheduleRerun ( id )
@@ -467,6 +471,7 @@ export class Vitest {
467
471
}
468
472
const onAdd = async ( id : string ) => {
469
473
id = slash ( id )
474
+ updateLastChanged ( id )
470
475
if ( await this . isTargetFile ( id ) ) {
471
476
this . changedTests . add ( id )
472
477
await this . cache . stats . updateStats ( id )
You can’t perform that action at this time.
0 commit comments