File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -360,6 +360,11 @@ export class Vitest {
360360 }
361361
362362 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+
363368 if ( this . coverageProvider && this . config . coverage . cleanOnRerun )
364369 await this . coverageProvider . clean ( )
365370
@@ -385,10 +390,9 @@ export class Vitest {
385390 this . filenamePattern = pattern
386391
387392 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 )
392396 }
393397
394398 async rerunFailed ( ) {
You can’t perform that action at this time.
0 commit comments