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);
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue