Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: allow pre-processing scripts (#11702)
Pavel Feldman29a84b2df831
diff --git a/packages/playwright-test/src/index.ts b/packages/playwright-test/src/index.tsindex d8b59cce66..77d4964309 100644--- a/packages/playwright-test/src/index.ts+++ b/packages/playwright-test/src/index.ts@@ -58,8 +58,10 @@ export const test = _baseTest.extend<TestFixtures, WorkerFixtures>({const gridClient = await GridClient.connect(process.env.PW_GRID);await use(gridClient.playwright() as any);gridClient.close();- } else if (process.env.PW_OUT_OF_PROCESS) {- const impl = await outOfProcess.start();+ } else if (process.env.PW_OUT_OF_PROCESS_DRIVER) {+ const impl = await outOfProcess.start({+ NODE_OPTIONS: undefined // Hide driver process while debugging.+ });await use(impl.playwright as any);await impl.stop();} else {diff --git a/packages/playwright-test/src/matchers/toMatchText.ts b/packages/playwright-test/src/matchers/toMatchText.tsindex fd3455c664..42cdb09730 100644--- a/packages/playwright-test/src/matchers/toMatchText.ts+++ b/packages/playwright-test/src/matchers/toMatchText.ts@@ -123,8 +123,6 @@ Call log:export function currentExpectTimeout(options: { timeout?: number }) {const testInfo = currentTestInfo();- if (testInfo && !testInfo.timeout)- return 0;if (options.timeout !== undefined)return options.timeout;let defaultExpectTimeout = testInfo?.project.expect?.timeout;diff --git a/packages/playwright-test/src/transform.ts b/packages/playwright-test/src/transform.tsindex 7a498352a5..3b311d08e8 100644--- a/packages/playwright-test/src/transform.ts+++ b/packages/playwright-test/src/transform.ts@@ -58,6 +58,7 @@ sourceMapSupport.install({function calculateCachePath(tsconfigData: ParsedTsConfigData | undefined, content: string, filePath: string): string {const hash = crypto.createHash('sha1').update(tsconfigData?.hash || '')+ .update(process.env.PW_TEST_SOURCE_TRANSFORM || '').update(process.env.PW_EXPERIMENTAL_TS_ESM ? 'esm' : 'no_esm').update(content).update(filePath)@@ -134,7 +135,6 @@ export function transformHook(code: string, filename: string, isModule = false):// Silence the annoying warning.process.env.BROWSERSLIST_IGNORE_OLD_DATA = 'true';const babel: typeof import('@babel/core') = require('@babel/core');-const plugins = [[require.resolve('@babel/plugin-proposal-class-properties')],[require.resolve('@babel/plugin-proposal-numeric-separator')],@@ -166,6 +166,9 @@ export function transformHook(code: string, filename: string, isModule = false):plugins.push([require.resolve('@babel/plugin-proposal-dynamic-import')]);}+ if (process.env.PW_TEST_SOURCE_TRANSFORM)+ plugins.push([process.env.PW_TEST_SOURCE_TRANSFORM]);+const result = babel.transformFileSync(filename, {babelrc: false,configFile: false,diff --git a/tests/config/default.playwright.config.ts b/tests/config/default.playwright.config.tsindex 4a9c5c967d..6d10a11326 100644--- a/tests/config/default.playwright.config.ts+++ b/tests/config/default.playwright.config.ts@@ -30,7 +30,7 @@ const getExecutablePath = (browserName: BrowserName) => {return process.env.WKPATH;};-const mode = process.env.PW_OUT_OF_PROCESS ?+const mode = process.env.PW_OUT_OF_PROCESS_DRIVER ?'driver' :(process.env.PWTEST_MODE || 'default') as ('default' | 'driver' | 'service');const headed = !!process.env.HEADFUL;diff --git a/tests/config/testMode.ts b/tests/config/testMode.tsindex 200ef7f9be..6f470cbc6a 100644--- a/tests/config/testMode.ts+++ b/tests/config/testMode.ts@@ -29,7 +29,9 @@ export class DriverTestMode implements TestMode {private _impl: { playwright: Playwright; stop: () => Promise<void>; };async setup() {- this._impl = await start();+ this._impl = await start({+ NODE_OPTIONS: undefined // Hide driver process while debugging.+ });return this._impl.playwright;}