Skip to content

Commit 52356a0

Browse files
authored
invert test filtering logic to exclude known failing (#56663)
### What? instead of include known passing tests also updates the update test manifest ### Why? Newly added test cases should always pass turbopack (or at least you would need to manually opt-out of it. ### How? Uses a exclude list of tests instead of an allow list Closes WEB-1752
1 parent 1b7895e commit 52356a0

File tree

2 files changed

+249
-230
lines changed

2 files changed

+249
-230
lines changed

run-tests.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function escapeRegexp(str) {
1717
}
1818

1919
/**
20-
* @typedef {{ file: string, cases: 'all' | string[] }} TestFile
20+
* @typedef {{ file: string, excludedCases: string[] }} TestFile
2121
*/
2222

2323
const GROUP = process.env.CI ? '##[group]' : ''
@@ -162,7 +162,7 @@ async function main() {
162162
.filter((arg) => arg.match(/\.test\.(js|ts|tsx)/))
163163
.map((file) => ({
164164
file,
165-
cases: 'all',
165+
excludedCases: [],
166166
}))
167167
let prevTimings
168168

@@ -198,7 +198,7 @@ async function main() {
198198
})
199199
.map((file) => ({
200200
file,
201-
cases: 'all',
201+
excludedCases: [],
202202
}))
203203
}
204204

@@ -238,10 +238,9 @@ async function main() {
238238
})
239239
.map((test) => {
240240
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
243242
if (info.failed.length > 0 || info.flakey.length > 0) {
244-
test.cases = info.passed
243+
test.excludedCases = info.failed.concat(info.flakey)
245244
}
246245
return test
247246
})
@@ -382,11 +381,11 @@ ${ENDGROUP}`)
382381
? ['--json', `--outputFile=${test.file}${RESULTS_EXT}`]
383382
: []),
384383
test.file,
385-
...(test.cases === 'all'
384+
...(test.excludedCases.length === 0
386385
? []
387386
: [
388387
'--testNamePattern',
389-
`^(${test.cases.map(escapeRegexp).join('|')})$`,
388+
`^(?!${test.excludedCases.map(escapeRegexp).join('|')})$`,
390389
]),
391390
]
392391
const env = {

0 commit comments

Comments
 (0)