chore: allow pre-processing scripts (#11702)
This commit is contained in:
parent
791860f31c
commit
29a84b2df8
|
|
@ -58,8 +58,10 @@ export const test = _baseTest.extend<TestFixtures, WorkerFixtures>({
|
||||||
const gridClient = await GridClient.connect(process.env.PW_GRID);
|
const gridClient = await GridClient.connect(process.env.PW_GRID);
|
||||||
await use(gridClient.playwright() as any);
|
await use(gridClient.playwright() as any);
|
||||||
gridClient.close();
|
gridClient.close();
|
||||||
} else if (process.env.PW_OUT_OF_PROCESS) {
|
} else if (process.env.PW_OUT_OF_PROCESS_DRIVER) {
|
||||||
const impl = await outOfProcess.start();
|
const impl = await outOfProcess.start({
|
||||||
|
NODE_OPTIONS: undefined // Hide driver process while debugging.
|
||||||
|
});
|
||||||
await use(impl.playwright as any);
|
await use(impl.playwright as any);
|
||||||
await impl.stop();
|
await impl.stop();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -123,8 +123,6 @@ Call log:
|
||||||
|
|
||||||
export function currentExpectTimeout(options: { timeout?: number }) {
|
export function currentExpectTimeout(options: { timeout?: number }) {
|
||||||
const testInfo = currentTestInfo();
|
const testInfo = currentTestInfo();
|
||||||
if (testInfo && !testInfo.timeout)
|
|
||||||
return 0;
|
|
||||||
if (options.timeout !== undefined)
|
if (options.timeout !== undefined)
|
||||||
return options.timeout;
|
return options.timeout;
|
||||||
let defaultExpectTimeout = testInfo?.project.expect?.timeout;
|
let defaultExpectTimeout = testInfo?.project.expect?.timeout;
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ sourceMapSupport.install({
|
||||||
function calculateCachePath(tsconfigData: ParsedTsConfigData | undefined, content: string, filePath: string): string {
|
function calculateCachePath(tsconfigData: ParsedTsConfigData | undefined, content: string, filePath: string): string {
|
||||||
const hash = crypto.createHash('sha1')
|
const hash = crypto.createHash('sha1')
|
||||||
.update(tsconfigData?.hash || '')
|
.update(tsconfigData?.hash || '')
|
||||||
|
.update(process.env.PW_TEST_SOURCE_TRANSFORM || '')
|
||||||
.update(process.env.PW_EXPERIMENTAL_TS_ESM ? 'esm' : 'no_esm')
|
.update(process.env.PW_EXPERIMENTAL_TS_ESM ? 'esm' : 'no_esm')
|
||||||
.update(content)
|
.update(content)
|
||||||
.update(filePath)
|
.update(filePath)
|
||||||
|
|
@ -134,7 +135,6 @@ export function transformHook(code: string, filename: string, isModule = false):
|
||||||
// Silence the annoying warning.
|
// Silence the annoying warning.
|
||||||
process.env.BROWSERSLIST_IGNORE_OLD_DATA = 'true';
|
process.env.BROWSERSLIST_IGNORE_OLD_DATA = 'true';
|
||||||
const babel: typeof import('@babel/core') = require('@babel/core');
|
const babel: typeof import('@babel/core') = require('@babel/core');
|
||||||
|
|
||||||
const plugins = [
|
const plugins = [
|
||||||
[require.resolve('@babel/plugin-proposal-class-properties')],
|
[require.resolve('@babel/plugin-proposal-class-properties')],
|
||||||
[require.resolve('@babel/plugin-proposal-numeric-separator')],
|
[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')]);
|
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, {
|
const result = babel.transformFileSync(filename, {
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
configFile: false,
|
configFile: false,
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ const getExecutablePath = (browserName: BrowserName) => {
|
||||||
return process.env.WKPATH;
|
return process.env.WKPATH;
|
||||||
};
|
};
|
||||||
|
|
||||||
const mode = process.env.PW_OUT_OF_PROCESS ?
|
const mode = process.env.PW_OUT_OF_PROCESS_DRIVER ?
|
||||||
'driver' :
|
'driver' :
|
||||||
(process.env.PWTEST_MODE || 'default') as ('default' | 'driver' | 'service');
|
(process.env.PWTEST_MODE || 'default') as ('default' | 'driver' | 'service');
|
||||||
const headed = !!process.env.HEADFUL;
|
const headed = !!process.env.HEADFUL;
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,9 @@ export class DriverTestMode implements TestMode {
|
||||||
private _impl: { playwright: Playwright; stop: () => Promise<void>; };
|
private _impl: { playwright: Playwright; stop: () => Promise<void>; };
|
||||||
|
|
||||||
async setup() {
|
async setup() {
|
||||||
this._impl = await start();
|
this._impl = await start({
|
||||||
|
NODE_OPTIONS: undefined // Hide driver process while debugging.
|
||||||
|
});
|
||||||
return this._impl.playwright;
|
return this._impl.playwright;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue