From 80f540ab8085c7f173b6ab3c0cc7a60c0b3c243b Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Mon, 26 Feb 2024 23:07:14 -0600 Subject: [PATCH] fix: use disable tracing env to return early --- packages/playwright/src/worker/testTracing.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/playwright/src/worker/testTracing.ts b/packages/playwright/src/worker/testTracing.ts index c820476f27..d017040f7f 100644 --- a/packages/playwright/src/worker/testTracing.ts +++ b/packages/playwright/src/worker/testTracing.ts @@ -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) {