@@ -3,7 +3,7 @@ import type { Writable } from 'node:stream'
33import type { ViteDevServer } from 'vite'
44import type { defineWorkspace } from 'vitest/config'
55import type { SerializedCoverageConfig } from '../runtime/config'
6- import type { ArgumentsType , OnServerRestartHandler , OnWatcherRerunHandler , ProvidedContext , UserConsoleLog } from '../types/general'
6+ import type { ArgumentsType , OnServerRestartHandler , OnTestsRerunHandler , ProvidedContext , UserConsoleLog } from '../types/general'
77import type { ProcessPool , WorkspaceSpec } from './pool'
88import type { TestSpecification } from './spec'
99import type { ResolvedConfig , UserConfig , VitestRunMode } from './types/config'
@@ -102,7 +102,7 @@ export class Vitest {
102102 private _onClose : ( ( ) => Awaited < unknown > ) [ ] = [ ]
103103 private _onSetServer : OnServerRestartHandler [ ] = [ ]
104104 private _onCancelListeners : ( ( reason : CancelReason ) => Promise < void > | void ) [ ] = [ ]
105- private _onUserWatcherRerun : OnWatcherRerunHandler [ ] = [ ]
105+ private _onUserTestsRerun : OnTestsRerunHandler [ ] = [ ]
106106
107107 async setServer ( options : UserConfig , server : ViteDevServer , cliOptions : UserConfig ) {
108108 this . unregisterWatcher ?.( )
@@ -114,7 +114,7 @@ export class Vitest {
114114 this . coverageProvider = undefined
115115 this . runningPromise = undefined
116116 this . _cachedSpecs . clear ( )
117- this . _onUserWatcherRerun = [ ]
117+ this . _onUserTestsRerun = [ ]
118118
119119 const resolved = resolveConfig ( this . mode , options , server . config , this . logger )
120120
@@ -695,7 +695,7 @@ export class Vitest {
695695
696696 await Promise . all ( [
697697 this . report ( 'onWatcherRerun' , files , trigger ) ,
698- ...this . _onUserWatcherRerun . map ( fn => fn ( files ) ) ,
698+ ...this . _onUserTestsRerun . map ( fn => fn ( files ) ) ,
699699 ] )
700700 await this . runFiles ( files . flatMap ( file => this . getProjectsByTestFile ( file ) ) , allTestsRun )
701701
@@ -820,7 +820,7 @@ export class Vitest {
820820 const triggerLabel = Array . from ( triggerIds ) . join ( ', ' )
821821 await Promise . all ( [
822822 this . report ( 'onWatcherRerun' , files , triggerLabel ) ,
823- ...this . _onUserWatcherRerun . map ( fn => fn ( files ) ) ,
823+ ...this . _onUserTestsRerun . map ( fn => fn ( files ) ) ,
824824 ] )
825825
826826 await this . runFiles ( files . flatMap ( file => this . getProjectsByTestFile ( file ) ) , false )
@@ -1159,7 +1159,7 @@ export class Vitest {
11591159 this . _onClose . push ( fn )
11601160 }
11611161
1162- onWatcherRerun ( fn : OnWatcherRerunHandler ) : void {
1163- this . _onUserWatcherRerun . push ( fn )
1162+ onTestsRerun ( fn : OnTestsRerunHandler ) : void {
1163+ this . _onUserTestsRerun . push ( fn )
11641164 }
11651165}
0 commit comments