Skip to content

Commit

Permalink
invert test filtering logic to exclude known failing (#56663)
Browse files Browse the repository at this point in the history
### 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
  • Loading branch information
sokra committed Oct 10, 2023
1 parent 1b7895e commit 52356a0
Show file tree
Hide file tree
Showing 2 changed files with 249 additions and 230 deletions.
15 changes: 7 additions & 8 deletions run-tests.js
Expand Up @@ -17,7 +17,7 @@ function escapeRegexp(str) {
}

/**
* @typedef {{ file: string, cases: 'all' | string[] }} TestFile
* @typedef {{ file: string, excludedCases: string[] }} TestFile
*/

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

Expand Down Expand Up @@ -198,7 +198,7 @@ async function main() {
})
.map((file) => ({
file,
cases: 'all',
excludedCases: [],
}))
}

Expand Down Expand Up @@ -238,10 +238,9 @@ async function main() {
})
.map((test) => {
const info = externalTestsFilterLists[test.file]
// only run filtered mode when there are failing tests.
// When the whole test suite passes we can run all tests, including newly added ones.
// Exclude failing and flakey tests, newly added tests are automatically included
if (info.failed.length > 0 || info.flakey.length > 0) {
test.cases = info.passed
test.excludedCases = info.failed.concat(info.flakey)
}
return test
})
Expand Down Expand Up @@ -382,11 +381,11 @@ ${ENDGROUP}`)
? ['--json', `--outputFile=${test.file}${RESULTS_EXT}`]
: []),
test.file,
...(test.cases === 'all'
...(test.excludedCases.length === 0
? []
: [
'--testNamePattern',
`^(${test.cases.map(escapeRegexp).join('|')})$`,
`^(?!${test.excludedCases.map(escapeRegexp).join('|')})$`,
]),
]
const env = {
Expand Down

0 comments on commit 52356a0

Please sign in to comment.