chore: use JobDispatcher helper in one more place (#27299)

This commit is contained in:
Dmitry Gozman 2023-09-25 20:08:22 -07:00 committed by GitHub
parent aed86c98a8
commit c0dc2328aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -441,24 +441,15 @@ class JobDispatcher {
serialSuitesWithFailures.add(outermostSerialSuite);
}
// We have failed tests that belong to a serial suite.
// We should skip all future tests from the same serial suite.
for (const test of this._remainingByTestId.values()) {
// If we have failed tests that belong to a serial suite,
// we should skip all future tests from the same serial suite.
const testsBelongingToSomeSerialSuiteWithFailures = [...this._remainingByTestId.values()].filter(test => {
let parent: Suite | undefined = test.parent;
while (parent && !serialSuitesWithFailures.has(parent))
parent = parent.parent;
// Does not belong to the failed serial suite, keep it.
if (!parent)
continue;
// Emulate a "skipped" run, and drop this test from remaining.
const result = test._appendTestResult();
this._reporter.onTestBegin(test, result);
result.status = 'skipped';
this._reportTestEnd(test, result);
this._remainingByTestId.delete(test.id);
}
return !!parent;
});
this._massSkipTestsFromRemaining(new Set(testsBelongingToSomeSerialSuiteWithFailures.map(test => test.id)), []);
for (const serialSuite of serialSuitesWithFailures) {
// Add all tests from faiiled serial suites for possible retry.