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

This commit is contained in:
Pavel Feldman 2020-08-26 22:29:23 -07:00 committed by GitHub
parent 06154060a2
commit efd45f8b51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -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)),

View File

@ -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) {