@@ -136,10 +136,10 @@ export async function createRootSuite(testRun: TestRun, errors: TestError[], sho
136136
137137 // Filter file suites for all projects.
138138 for ( const [ project , fileSuites ] of testRun . projectSuites ) {
139- const filteredFileSuites = additionalFileMatcher ? fileSuites . filter ( fileSuite => additionalFileMatcher ( fileSuite . location ! . file ) ) : fileSuites ;
140- const projectSuite = createProjectSuite ( project , filteredFileSuites ) ;
139+ const projectSuite = createProjectSuite ( project , fileSuites ) ;
141140 projectSuites . set ( project , projectSuite ) ;
142- const filteredProjectSuite = filterProjectSuite ( projectSuite , { cliFileFilters, cliTitleMatcher, testIdMatcher : config . testIdMatcher } ) ;
141+
142+ const filteredProjectSuite = filterProjectSuite ( projectSuite , { cliFileFilters, cliTitleMatcher, testIdMatcher : config . testIdMatcher , additionalFileMatcher } ) ;
143143 filteredProjectSuites . set ( project , filteredProjectSuite ) ;
144144 }
145145 }
@@ -200,8 +200,8 @@ export async function createRootSuite(testRun: TestRun, errors: TestError[], sho
200200 const projectClosure = new Map ( buildProjectsClosure ( rootSuite . suites . map ( suite => suite . _fullProject ! ) ) ) ;
201201
202202 // Clone file suites for dependency projects.
203- for ( const project of projectClosure . keys ( ) ) {
204- if ( projectClosure . get ( project ) === 'dependency' )
203+ for ( const [ project , level ] of projectClosure . entries ( ) ) {
204+ if ( level === 'dependency' )
205205 rootSuite . _prependSuite ( buildProjectSuite ( project , projectSuites . get ( project ) ! ) ) ;
206206 }
207207 }
@@ -225,9 +225,9 @@ function createProjectSuite(project: FullProjectInternal, fileSuites: Suite[]):
225225 return projectSuite ;
226226}
227227
228- function filterProjectSuite ( projectSuite : Suite , options : { cliFileFilters : TestFileFilter [ ] , cliTitleMatcher ?: Matcher , testIdMatcher ?: Matcher } ) : Suite {
228+ function filterProjectSuite ( projectSuite : Suite , options : { cliFileFilters : TestFileFilter [ ] , cliTitleMatcher ?: Matcher , testIdMatcher ?: Matcher , additionalFileMatcher ?: Matcher } ) : Suite {
229229 // Fast path.
230- if ( ! options . cliFileFilters . length && ! options . cliTitleMatcher && ! options . testIdMatcher )
230+ if ( ! options . cliFileFilters . length && ! options . cliTitleMatcher && ! options . testIdMatcher && ! options . additionalFileMatcher )
231231 return projectSuite ;
232232
233233 const result = projectSuite . _deepClone ( ) ;
@@ -238,6 +238,8 @@ function filterProjectSuite(projectSuite: Suite, options: { cliFileFilters: Test
238238 filterTestsRemoveEmptySuites ( result , ( test : TestCase ) => {
239239 if ( options . cliTitleMatcher && ! options . cliTitleMatcher ( test . _grepTitle ( ) ) )
240240 return false ;
241+ if ( options . additionalFileMatcher && ! options . additionalFileMatcher ( test . location . file ) )
242+ return false ;
241243 return true ;
242244 } ) ;
243245 return result ;
0 commit comments