fix: use disable tracing env to return early

This commit is contained in:
Stevan Freeborn 2024-02-26 23:07:14 -06:00
parent bd3dd9de1c
commit 80f540ab80

View file

@ -48,15 +48,14 @@ export class TestTracing {
}
private _shouldCaptureTrace() {
let capture = false;
if (process.env.PW_TEST_DISABLE_TRACING) return false;
if (this._options?.mode === 'on') return true;
if (this._options?.mode === 'retain-on-failure') return true;
if (this._options?.mode === 'on-first-retry' && this._testInfo.retry === 1) return true;
if (this._options?.mode === 'on-all-retries' && this._testInfo.retry > 0) return true;
if (this._options?.mode === 'retain-on-first-failure' && this._testInfo.retry === 0) return true;
if (this._options?.mode === 'on') capture = true;
if (this._options?.mode === 'retain-on-failure') capture = true;
if (this._options?.mode === 'on-first-retry' && this._testInfo.retry === 1) capture = true;
if (this._options?.mode === 'on-all-retries' && this._testInfo.retry > 0) capture = true;
if (this._options?.mode === 'retain-on-first-failure' && this._testInfo.retry === 0) capture = true;
return capture && !process.env.PW_TEST_DISABLE_TRACING;
return false;
}
async startIfNeeded(value: TraceFixtureValue) {