File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -360,6 +360,11 @@ export class Vitest {
360
360
}
361
361
362
362
async rerunFiles ( files : string [ ] = this . state . getFilepaths ( ) , trigger ?: string ) {
363
+ if ( this . filenamePattern ) {
364
+ const filteredFiles = await this . globTestFiles ( [ this . filenamePattern ] )
365
+ files = files . filter ( file => filteredFiles . includes ( file ) )
366
+ }
367
+
363
368
if ( this . coverageProvider && this . config . coverage . cleanOnRerun )
364
369
await this . coverageProvider . clean ( )
365
370
@@ -385,10 +390,9 @@ export class Vitest {
385
390
this . filenamePattern = pattern
386
391
387
392
const files = this . state . getFilepaths ( )
388
- if ( ! this . filenamePattern )
389
- return await this . rerunFiles ( files , 'reset filename pattern' )
390
- const filteredFiles = await this . globTestFiles ( [ this . filenamePattern ] )
391
- await this . rerunFiles ( filteredFiles , 'change filename pattern' )
393
+ const trigger = this . filenamePattern ? 'change filename pattern' : 'reset filename pattern'
394
+
395
+ await this . rerunFiles ( files , trigger )
392
396
}
393
397
394
398
async rerunFailed ( ) {
You can’t perform that action at this time.
0 commit comments