Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: ensure max failures exit yields erroneous status code (#30120)

Pavel Feldman0bf635ecce54
diff --git a/packages/playwright/src/runner/dispatcher.ts b/packages/playwright/src/runner/dispatcher.ts
index da2b759aa6..9fdb620f2c 100644
--- a/packages/playwright/src/runner/dispatcher.ts
+++ b/packages/playwright/src/runner/dispatcher.ts
@@ -229,13 +229,6 @@ export class Dispatcher {
await Promise.all(this._workerSlots.map(({ worker }) => worker?.stop()));
this._checkFinished();
}
-
- private _reportTestEnd(test: TestCase, result: TestResult) {
- this._reporter.onTestEnd(test, result);
- this._failureTracker.onTestEnd(test, result);
- if (this._failureTracker.hasReachedMaxFailures())
- this.stop().catch(e => {});
- }
}
class JobDispatcher {
diff --git a/packages/playwright/src/runner/failureTracker.ts b/packages/playwright/src/runner/failureTracker.ts
index fc2202b3ea..eb39b1d44f 100644
--- a/packages/playwright/src/runner/failureTracker.ts
+++ b/packages/playwright/src/runner/failureTracker.ts
@@ -49,6 +49,6 @@ export class FailureTracker {
}
result(): 'failed' | 'passed' {
- return this._hasWorkerErrors || this._rootSuite?.allTests().some(test => !test.ok()) ? 'failed' : 'passed';
+ return this._hasWorkerErrors || this.hasReachedMaxFailures() || this._rootSuite?.allTests().some(test => !test.ok()) ? 'failed' : 'passed';
}
}