@@ -58,7 +58,7 @@ export class Vitest implements VitestMethods {
5858 }
5959 else {
6060 const specs = await this . globTestFiles ( files )
61- await this . runTestFiles ( specs . map ( ( [ _ , spec ] ) => spec ) )
61+ await this . runTestFiles ( specs . map ( ( [ _ , spec ] ) => spec ) , undefined , ! files )
6262 }
6363 }
6464
@@ -82,15 +82,15 @@ export class Vitest implements VitestMethods {
8282 return files
8383 }
8484
85- private async runTestFiles ( files : string [ ] , testNamePattern ?: string | undefined ) {
85+ private async runTestFiles ( files : string [ ] , testNamePattern ?: string | undefined , runAllFiles = false ) {
8686 await this . ctx . runningPromise
8787 this . watcher . markRerun ( false )
8888 process . chdir ( this . cwd )
8989
9090 try {
9191 this . setTestNamePattern ( testNamePattern )
9292
93- await this . rerunTests ( files )
93+ await this . rerunTests ( files , runAllFiles )
9494 }
9595 finally {
9696 process . chdir ( cwd )
@@ -101,9 +101,9 @@ export class Vitest implements VitestMethods {
101101 this . ctx . configOverride . testNamePattern = pattern ? new RegExp ( pattern ) : undefined
102102 }
103103
104- private async rerunTests ( files : string [ ] ) {
104+ private async rerunTests ( files : string [ ] , runAllFiles = false ) {
105105 await this . ctx . report ( 'onWatcherRerun' , files )
106- await this . ctx . runFiles ( files . flatMap ( file => this . ctx . getProjectsByTestFile ( file ) ) , false )
106+ await this . ctx . runFiles ( files . flatMap ( file => this . ctx . getProjectsByTestFile ( file ) ) , runAllFiles )
107107
108108 await this . ctx . report ( 'onWatcherStart' , this . ctx . state . getFiles ( files ) )
109109 }
0 commit comments