Skip to content

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

fix(testrunner): report tests as passed in the trial-run mode (#3654)

Pavel Feldmanefd45f8b51ca
diff --git a/test-runner/src/reporters/json.ts b/test-runner/src/reporters/json.ts
index 2382c6f228..e32d32d7f0 100644
--- a/test-runner/src/reporters/json.ts
+++ b/test-runner/src/reporters/json.ts
@@ -58,6 +58,7 @@ class JSONReporter extends BaseReporter {
private _serializeTestResult(result: TestResult): any {
return {
+ status: result.status,
duration: result.duration,
error: result.error,
stdout: result.stdout.map(s => stdioEntry(s)),
diff --git a/test-runner/src/testRunner.ts b/test-runner/src/testRunner.ts
index cca9fe9a4f..d6691ab087 100644
--- a/test-runner/src/testRunner.ts
+++ b/test-runner/src/testRunner.ts
@@ -170,12 +170,14 @@ export class TestRunner extends EventEmitter {
const startTime = Date.now();
try {
const testInfo = { config: this._config, test, result };
- await this._runHooks(test.suite, 'beforeEach', 'before', testInfo);
if (!this._trialRun) {
+ await this._runHooks(test.suite, 'beforeEach', 'before', testInfo);
const timeout = test.slow ? this._timeout * 3 : this._timeout;
await fixturePool.runTestWithFixtures(test.fn, timeout, testInfo);
+ await this._runHooks(test.suite, 'afterEach', 'after', testInfo);
+ } else {
+ result.status = 'passed';
}
- await this._runHooks(test.suite, 'afterEach', 'after', testInfo);
result.duration = Date.now() - startTime;
this.emit('testEnd', { id, result });
} catch (error) {