@@ -136,10 +136,10 @@ export async function createRootSuite(testRun: TestRun, errors: TestError[], sho
136
136
137
137
// Filter file suites for all projects.
138
138
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 ) ;
141
140
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 } ) ;
143
143
filteredProjectSuites . set ( project , filteredProjectSuite ) ;
144
144
}
145
145
}
@@ -200,8 +200,8 @@ export async function createRootSuite(testRun: TestRun, errors: TestError[], sho
200
200
const projectClosure = new Map ( buildProjectsClosure ( rootSuite . suites . map ( suite => suite . _fullProject ! ) ) ) ;
201
201
202
202
// 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' )
205
205
rootSuite . _prependSuite ( buildProjectSuite ( project , projectSuites . get ( project ) ! ) ) ;
206
206
}
207
207
}
@@ -225,9 +225,9 @@ function createProjectSuite(project: FullProjectInternal, fileSuites: Suite[]):
225
225
return projectSuite ;
226
226
}
227
227
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 {
229
229
// Fast path.
230
- if ( ! options . cliFileFilters . length && ! options . cliTitleMatcher && ! options . testIdMatcher )
230
+ if ( ! options . cliFileFilters . length && ! options . cliTitleMatcher && ! options . testIdMatcher && ! options . additionalFileMatcher )
231
231
return projectSuite ;
232
232
233
233
const result = projectSuite . _deepClone ( ) ;
@@ -238,6 +238,8 @@ function filterProjectSuite(projectSuite: Suite, options: { cliFileFilters: Test
238
238
filterTestsRemoveEmptySuites ( result , ( test : TestCase ) => {
239
239
if ( options . cliTitleMatcher && ! options . cliTitleMatcher ( test . _grepTitle ( ) ) )
240
240
return false ;
241
+ if ( options . additionalFileMatcher && ! options . additionalFileMatcher ( test . location . file ) )
242
+ return false ;
241
243
return true ;
242
244
} ) ;
243
245
return result ;
0 commit comments