fix: support PWDEBUG=0 to disable debug (#11611)

Fixes #11606
This commit is contained in:
Andrey Lushnikov 2022-01-25 09:40:24 -07:00 committed by GitHub
parent e10cb4a619
commit 42876a0528
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -325,6 +325,8 @@ const debugEnv = getFromENV('PWDEBUG') || '';
export function debugMode() {
if (debugEnv === 'console')
return 'console';
if (debugEnv === '0' || debugEnv === 'false')
return '';
return debugEnv ? 'inspector' : '';
}

View File

@ -19,7 +19,7 @@ import * as path from 'path';
import type { LaunchOptions, BrowserContextOptions, Page, BrowserContext, BrowserType, Video, Browser, APIRequestContext } from 'playwright-core';
import type { TestType, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, TestInfo } from '../types/test';
import { rootTestType } from './testType';
import { createGuid, removeFolders } from 'playwright-core/lib/utils/utils';
import { createGuid, removeFolders, debugMode } from 'playwright-core/lib/utils/utils';
import { GridClient } from 'playwright-core/lib/grid/gridClient';
import { prependToTestError } from './util';
export { expect } from './expect';
@ -190,7 +190,7 @@ export const test = _baseTest.extend<TestFixtures, WorkerFixtures>({
_setupContextOptionsAndArtifacts: [async ({ playwright, _snapshotSuffix, _combinedContextOptions, _artifactsDir, trace, screenshot, actionTimeout, navigationTimeout }, use, testInfo) => {
testInfo.snapshotSuffix = _snapshotSuffix;
if (process.env.PWDEBUG)
if (debugMode())
testInfo.setTimeout(0);
let traceMode = typeof trace === 'string' ? trace : trace.mode;