@@ -17,7 +17,7 @@ function escapeRegexp(str) {
17
17
}
18
18
19
19
/**
20
- * @typedef {{ file: string, cases: 'all' | string[] } } TestFile
20
+ * @typedef {{ file: string, excludedCases: string[] } } TestFile
21
21
*/
22
22
23
23
const GROUP = process . env . CI ? '##[group]' : ''
@@ -162,7 +162,7 @@ async function main() {
162
162
. filter ( ( arg ) => arg . match ( / \. t e s t \. ( j s | t s | t s x ) / ) )
163
163
. map ( ( file ) => ( {
164
164
file,
165
- cases : 'all' ,
165
+ excludedCases : [ ] ,
166
166
} ) )
167
167
let prevTimings
168
168
@@ -198,7 +198,7 @@ async function main() {
198
198
} )
199
199
. map ( ( file ) => ( {
200
200
file,
201
- cases : 'all' ,
201
+ excludedCases : [ ] ,
202
202
} ) )
203
203
}
204
204
@@ -238,10 +238,9 @@ async function main() {
238
238
} )
239
239
. map ( ( test ) => {
240
240
const info = externalTestsFilterLists [ test . file ]
241
- // only run filtered mode when there are failing tests.
242
- // When the whole test suite passes we can run all tests, including newly added ones.
241
+ // Exclude failing and flakey tests, newly added tests are automatically included
243
242
if ( info . failed . length > 0 || info . flakey . length > 0 ) {
244
- test . cases = info . passed
243
+ test . excludedCases = info . failed . concat ( info . flakey )
245
244
}
246
245
return test
247
246
} )
@@ -382,11 +381,11 @@ ${ENDGROUP}`)
382
381
? [ '--json' , `--outputFile=${ test . file } ${ RESULTS_EXT } ` ]
383
382
: [ ] ) ,
384
383
test . file ,
385
- ...( test . cases === 'all'
384
+ ...( test . excludedCases . length === 0
386
385
? [ ]
387
386
: [
388
387
'--testNamePattern' ,
389
- `^(${ test . cases . map ( escapeRegexp ) . join ( '|' ) } )$` ,
388
+ `^(?! ${ test . excludedCases . map ( escapeRegexp ) . join ( '|' ) } )$` ,
390
389
] ) ,
391
390
]
392
391
const env = {
0 commit comments