diff --git a/packages/playwright/src/worker/testTracing.ts b/packages/playwright/src/worker/testTracing.ts index bde5cd47a5..c9ad6839b7 100644 --- a/packages/playwright/src/worker/testTracing.ts +++ b/packages/playwright/src/worker/testTracing.ts @@ -48,12 +48,24 @@ export class TestTracing { } private _shouldCaptureTrace() { - 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 (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; + return false; }