chore: group test runner files by process (#20425)
This commit is contained in:
parent
99f0560122
commit
7d7e66f450
|
|
@ -3,7 +3,7 @@
|
|||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"esbuild": "esbuild ./src/babelBundleImpl.ts --bundle --outdir=../../lib --format=cjs --platform=node --target=ES2019",
|
||||
"esbuild": "esbuild ./src/babelBundleImpl.ts --bundle --outdir=../../lib/common --format=cjs --platform=node --target=ES2019",
|
||||
"build": "npm run esbuild -- --minify",
|
||||
"watch": "npm run esbuild -- --watch --sourcemap",
|
||||
"generate-license": "node ../../../../utils/generate_third_party_notice.js"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"esbuild": "esbuild ./src/expectBundleImpl.ts --bundle --outdir=../../lib --format=cjs --platform=node --target=ES2019",
|
||||
"esbuild": "esbuild ./src/expectBundleImpl.ts --bundle --outdir=../../lib/common --format=cjs --platform=node --target=ES2019",
|
||||
"build": "npm run esbuild -- --minify",
|
||||
"watch": "npm run esbuild -- --watch --sourcemap",
|
||||
"generate-license": "node ../../../../utils/generate_third_party_notice.js"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
[*]
|
||||
../types.ts
|
||||
common/
|
||||
./utils.ts
|
||||
./utilsBundle.ts
|
||||
runner/
|
||||
matchers/
|
||||
reporters/
|
||||
third_party/
|
||||
plugins/
|
||||
|
||||
[cli.ts]
|
||||
**
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { BabelFileResult } from '../bundles/babel/node_modules/@types/babel__core';
|
||||
export const codeFrameColumns: typeof import('../bundles/babel/node_modules/@types/babel__code-frame').codeFrameColumns = require('./babelBundleImpl').codeFrameColumns;
|
||||
export const declare: typeof import('../bundles/babel/node_modules/@types/babel__helper-plugin-utils').declare = require('./babelBundleImpl').declare;
|
||||
export const types: typeof import('../bundles/babel/node_modules/@types/babel__core').types = require('./babelBundleImpl').types;
|
||||
export const parse: typeof import('../bundles/babel/node_modules/@babel/parser').parse = require('./babelBundleImpl').parse;
|
||||
export const traverse: typeof import('../bundles/babel/node_modules/@types/babel__traverse').default = require('./babelBundleImpl').traverse;
|
||||
export type BabelTransformFunction = (filename: string, isTypeScript: boolean, isModule: boolean, scriptPreprocessor: string | undefined, additionalPlugin: [string]) => BabelFileResult;
|
||||
export const babelTransform: BabelTransformFunction = require('./babelBundleImpl').babelTransform;
|
||||
export type { NodePath, types as T } from '../bundles/babel/node_modules/@types/babel__core';
|
||||
export type { BabelAPI } from '../bundles/babel/node_modules/@types/babel__helper-plugin-utils';
|
||||
|
|
@ -18,18 +18,17 @@
|
|||
|
||||
import type { Command } from 'playwright-core/lib/utilsBundle';
|
||||
import fs from 'fs';
|
||||
import url from 'url';
|
||||
import path from 'path';
|
||||
import { Runner } from './runner';
|
||||
import type { ConfigCLIOverrides } from './runner';
|
||||
import { stopProfiling, startProfiling } from './profiler';
|
||||
import { fileIsModule } from './util';
|
||||
import { Runner } from './runner/runner';
|
||||
import { stopProfiling, startProfiling } from './common/profiler';
|
||||
import { experimentalLoaderOption, fileIsModule } from './util';
|
||||
import type { TestFileFilter } from './util';
|
||||
import { createTitleMatcher } from './util';
|
||||
import { showHTMLReport } from './reporters/html';
|
||||
import { baseFullConfig, defaultTimeout, kDefaultConfigFiles, resolveConfigFile } from './configLoader';
|
||||
import type { TraceMode } from './types';
|
||||
import { baseFullConfig, defaultTimeout, kDefaultConfigFiles, resolveConfigFile } from './common/configLoader';
|
||||
import type { TraceMode } from './common/types';
|
||||
import { builtInReporters } from './runner/reporters';
|
||||
import type { ConfigCLIOverrides } from './common/ipc';
|
||||
|
||||
export function addTestCommands(program: Command) {
|
||||
addTestCommand(program);
|
||||
|
|
@ -267,16 +266,4 @@ function restartWithExperimentalTsEsm(configFile: string | null): boolean {
|
|||
return true;
|
||||
}
|
||||
|
||||
export function experimentalLoaderOption() {
|
||||
return ` --no-warnings --experimental-loader=${url.pathToFileURL(require.resolve('@playwright/test/lib/experimentalLoader')).toString()}`;
|
||||
}
|
||||
|
||||
export function envWithoutExperimentalLoaderOptions(): NodeJS.ProcessEnv {
|
||||
const substring = experimentalLoaderOption();
|
||||
const result = { ...process.env };
|
||||
if (result.NODE_OPTIONS)
|
||||
result.NODE_OPTIONS = result.NODE_OPTIONS.replace(substring, '').trim() || undefined;
|
||||
return result;
|
||||
}
|
||||
|
||||
const kTraceModes: TraceMode[] = ['on', 'off', 'on-first-retry', 'retain-on-failure'];
|
||||
|
|
|
|||
11
packages/playwright-test/src/common/DEPS.list
Normal file
11
packages/playwright-test/src/common/DEPS.list
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[*]
|
||||
../common/
|
||||
../matchers/
|
||||
../util.ts
|
||||
../utilsBundle.ts
|
||||
|
||||
[transform.ts]
|
||||
../third_party/tsconfig-loader.ts
|
||||
|
||||
[configLoader.ts]
|
||||
../runner/reporters.ts
|
||||
26
packages/playwright-test/src/common/babelBundle.ts
Normal file
26
packages/playwright-test/src/common/babelBundle.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { BabelFileResult } from '../../bundles/babel/node_modules/@types/babel__core';
|
||||
export const codeFrameColumns: typeof import('../../bundles/babel/node_modules/@types/babel__code-frame').codeFrameColumns = require('./babelBundleImpl').codeFrameColumns;
|
||||
export const declare: typeof import('../../bundles/babel/node_modules/@types/babel__helper-plugin-utils').declare = require('./babelBundleImpl').declare;
|
||||
export const types: typeof import('../../bundles/babel/node_modules/@types/babel__core').types = require('./babelBundleImpl').types;
|
||||
export const parse: typeof import('../../bundles/babel/node_modules/@babel/parser/typings/babel-parser').parse = require('./babelBundleImpl').parse;
|
||||
export const traverse: typeof import('../../bundles/babel/node_modules/@types/babel__traverse').default = require('./babelBundleImpl').traverse;
|
||||
export type BabelTransformFunction = (filename: string, isTypeScript: boolean, isModule: boolean, scriptPreprocessor: string | undefined, additionalPlugin: [string]) => BabelFileResult;
|
||||
export const babelTransform: BabelTransformFunction = require('./babelBundleImpl').babelTransform;
|
||||
export type { NodePath, types as T } from '../../bundles/babel/node_modules/@types/babel__core';
|
||||
export type { BabelAPI } from '../../bundles/babel/node_modules/@types/babel__helper-plugin-utils';
|
||||
|
|
@ -18,13 +18,12 @@ import * as fs from 'fs';
|
|||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import { isRegExp } from 'playwright-core/lib/utils';
|
||||
import type { Reporter } from '../types/testReporter';
|
||||
import type { SerializedConfig } from './ipc';
|
||||
import type { ConfigCLIOverrides } from './runner';
|
||||
import { builtInReporters, toReporters } from './runner/reporters';
|
||||
import type { Reporter } from '../../types/testReporter';
|
||||
import type { ConfigCLIOverrides, SerializedConfig } from './ipc';
|
||||
import { builtInReporters, toReporters } from '../runner/reporters';
|
||||
import { requireOrImport } from './transform';
|
||||
import type { Config, FullConfigInternal, FullProjectInternal, Project, ReporterDescription } from './types';
|
||||
import { errorWithFile, getPackageJsonPath, mergeObjects } from './util';
|
||||
import { errorWithFile, getPackageJsonPath, mergeObjects } from '../util';
|
||||
|
||||
export const defaultTimeout = 30000;
|
||||
|
||||
|
|
@ -457,7 +456,7 @@ export const baseFullConfig: FullConfigInternal = {
|
|||
quiet: false,
|
||||
shard: null,
|
||||
updateSnapshots: 'missing',
|
||||
version: require('../package.json').version,
|
||||
version: require('../../package.json').version,
|
||||
workers: 0,
|
||||
webServer: null,
|
||||
_webServers: [],
|
||||
20
packages/playwright-test/src/common/expectBundle.ts
Normal file
20
packages/playwright-test/src/common/expectBundle.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const expect: typeof import('../../bundles/expect/node_modules/expect/build') = require('./expectBundleImpl').expect;
|
||||
export const INVERTED_COLOR: typeof import('../../bundles/expect/node_modules/jest-matcher-utils/build').INVERTED_COLOR = require('./expectBundleImpl').INVERTED_COLOR;
|
||||
export const RECEIVED_COLOR: typeof import('../../bundles/expect/node_modules/jest-matcher-utils/build').RECEIVED_COLOR = require('./expectBundleImpl').RECEIVED_COLOR;
|
||||
export const printReceived: typeof import('../../bundles/expect/node_modules/jest-matcher-utils/build').printReceived = require('./expectBundleImpl').printReceived;
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { formatLocation, debugTest } from './util';
|
||||
import { formatLocation, debugTest } from '../util';
|
||||
import * as crypto from 'crypto';
|
||||
import type { FixturesWithLocation, Location, WorkerInfo } from './types';
|
||||
import { ManualPromise } from 'playwright-core/lib/utils';
|
||||
|
|
@ -14,9 +14,27 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { ConfigCLIOverrides } from './runner';
|
||||
import type { TestInfoError, TestStatus } from './types';
|
||||
|
||||
export type ConfigCLIOverrides = {
|
||||
forbidOnly?: boolean;
|
||||
fullyParallel?: boolean;
|
||||
globalTimeout?: number;
|
||||
maxFailures?: number;
|
||||
outputDir?: string;
|
||||
quiet?: boolean;
|
||||
repeatEach?: number;
|
||||
retries?: number;
|
||||
reporter?: string;
|
||||
shard?: { current: number, total: number };
|
||||
timeout?: number;
|
||||
ignoreSnapshots?: boolean;
|
||||
updateSnapshots?: 'all'|'none'|'missing';
|
||||
workers?: number;
|
||||
projects?: { name: string, use?: any }[],
|
||||
use?: any;
|
||||
};
|
||||
|
||||
export type SerializedConfig = {
|
||||
configFile: string | undefined;
|
||||
configDir: string;
|
||||
|
|
@ -19,7 +19,7 @@ import type { LoadError } from './fixtures';
|
|||
import type { Suite, TestCase } from './test';
|
||||
import type { TestTypeImpl } from './testType';
|
||||
import type { Fixtures, FixturesWithLocation, FullProjectInternal } from './types';
|
||||
import { formatLocation } from './util';
|
||||
import { formatLocation } from '../util';
|
||||
|
||||
export class PoolBuilder {
|
||||
private _project: FullProjectInternal | undefined;
|
||||
|
|
@ -18,7 +18,7 @@ import type { WriteStream } from 'tty';
|
|||
import type { ProcessInitParams, TtyParams } from './ipc';
|
||||
import { startProfiling, stopProfiling } from './profiler';
|
||||
import type { TestInfoError } from './types';
|
||||
import { serializeError } from './util';
|
||||
import { serializeError } from '../util';
|
||||
|
||||
export type ProtocolRequest = {
|
||||
id: number;
|
||||
|
|
@ -19,8 +19,8 @@ import { calculateSha1 } from 'playwright-core/lib/utils';
|
|||
import type { TestCase } from './test';
|
||||
import { Suite } from './test';
|
||||
import type { FullProjectInternal } from './types';
|
||||
import type { Matcher } from './util';
|
||||
import { createTitleMatcher } from './util';
|
||||
import type { Matcher } from '../util';
|
||||
import { createTitleMatcher } from '../util';
|
||||
|
||||
export async function createRootSuite(preprocessRoot: Suite, testTitleMatcher: Matcher, filesByProject: Map<FullProjectInternal, string[]>): Promise<Suite> {
|
||||
// Generate projects.
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import type { FixturePool } from './fixtures';
|
||||
import type * as reporterTypes from '../types/testReporter';
|
||||
import type * as reporterTypes from '../../types/testReporter';
|
||||
import type { TestTypeImpl } from './testType';
|
||||
import { rootTestType } from './testType';
|
||||
import type { Annotation, FixturesWithLocation, FullProject, FullProjectInternal, Location } from './types';
|
||||
|
|
@ -17,12 +17,12 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { monotonicTime } from 'playwright-core/lib/utils';
|
||||
import type { TestInfoError, TestInfo, TestStatus } from '../types/test';
|
||||
import type { TestInfoError, TestInfo, TestStatus } from '../../types/test';
|
||||
import type { StepBeginPayload, StepEndPayload, WorkerInitParams } from './ipc';
|
||||
import type { TestCase } from './test';
|
||||
import { TimeoutManager } from './timeoutManager';
|
||||
import type { Annotation, FullConfigInternal, FullProjectInternal, TestStepInternal } from './types';
|
||||
import { getContainedPath, normalizeAndSaveAttachment, sanitizeForFilePath, serializeError, trimLongString } from './util';
|
||||
import { getContainedPath, normalizeAndSaveAttachment, sanitizeForFilePath, serializeError, trimLongString } from '../util';
|
||||
|
||||
export class TestInfoImpl implements TestInfo {
|
||||
private _onStepBegin: (payload: StepBeginPayload) => void;
|
||||
|
|
@ -15,14 +15,14 @@
|
|||
*/
|
||||
|
||||
import path from 'path';
|
||||
import type { TestError } from '../reporter';
|
||||
import type { TestError } from '../../reporter';
|
||||
import type { FullConfigInternal } from './types';
|
||||
import type { LoadError } from './fixtures';
|
||||
import { setCurrentlyLoadingFileSuite } from './globals';
|
||||
import { PoolBuilder } from './poolBuilder';
|
||||
import { Suite } from './test';
|
||||
import { requireOrImport } from './transform';
|
||||
import { serializeError } from './util';
|
||||
import { serializeError } from '../util';
|
||||
|
||||
export const defaultTimeout = 30000;
|
||||
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { expect } from './expect';
|
||||
import { expect } from '../matchers/expect';
|
||||
import { currentlyLoadingFileSuite, currentTestInfo, setCurrentlyLoadingFileSuite } from './globals';
|
||||
import { TestCase, Suite } from './test';
|
||||
import { wrapFunctionWithLocation } from './transform';
|
||||
import type { Fixtures, FixturesWithLocation, Location, TestType } from './types';
|
||||
import { serializeError } from './util';
|
||||
import { serializeError } from '../util';
|
||||
|
||||
const testTypeSymbol = Symbol('testType');
|
||||
|
||||
|
|
@ -18,14 +18,14 @@ import crypto from 'crypto';
|
|||
import os from 'os';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import { sourceMapSupport, pirates } from './utilsBundle';
|
||||
import { sourceMapSupport, pirates } from '../utilsBundle';
|
||||
import url from 'url';
|
||||
import type { Location } from './types';
|
||||
import type { TsConfigLoaderResult } from './third_party/tsconfig-loader';
|
||||
import { tsConfigLoader } from './third_party/tsconfig-loader';
|
||||
import type { TsConfigLoaderResult } from '../third_party/tsconfig-loader';
|
||||
import { tsConfigLoader } from '../third_party/tsconfig-loader';
|
||||
import Module from 'module';
|
||||
import type { BabelTransformFunction } from './babelBundle';
|
||||
import { fileIsModule } from './util';
|
||||
import { fileIsModule } from '../util';
|
||||
|
||||
const version = 13;
|
||||
const cacheDir = process.env.PWTEST_CACHE_DIR || path.join(os.tmpdir(), 'playwright-transform-cache');
|
||||
|
|
@ -281,8 +281,8 @@ export function wrapFunctionWithLocation<A extends any[], R>(func: (location: Lo
|
|||
}
|
||||
|
||||
// This will catch the playwright-test package as well
|
||||
const kPlaywrightInternalPrefix = path.resolve(__dirname, '../../playwright');
|
||||
const kPlaywrightCoveragePrefix = path.resolve(__dirname, '../../../tests/config/coverage.js');
|
||||
const kPlaywrightInternalPrefix = path.resolve(__dirname, '../../../playwright');
|
||||
const kPlaywrightCoveragePrefix = path.resolve(__dirname, '../../../../tests/config/coverage.js');
|
||||
|
||||
export function belongsToNodeModules(file: string) {
|
||||
if (file.includes(`${path.sep}node_modules${path.sep}`))
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Fixtures, TestInfoError, Project } from '../types/test';
|
||||
import type { Location } from '../types/testReporter';
|
||||
import type { Fixtures, TestInfoError, Project } from '../../types/test';
|
||||
import type { Location } from '../../types/testReporter';
|
||||
import type { FullConfig as FullConfigPublic, FullProject as FullProjectPublic } from './types';
|
||||
export * from '../types/test';
|
||||
export type { Location } from '../types/testReporter';
|
||||
export * from '../../types/test';
|
||||
export type { Location } from '../../types/testReporter';
|
||||
|
||||
export type FixturesWithLocation = {
|
||||
fixtures: Fixtures;
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const expect: typeof import('../bundles/expect/node_modules/expect') = require('./expectBundleImpl').expect;
|
||||
export const INVERTED_COLOR: typeof import('../bundles/expect/node_modules/jest-matcher-utils').INVERTED_COLOR = require('./expectBundleImpl').INVERTED_COLOR;
|
||||
export const RECEIVED_COLOR: typeof import('../bundles/expect/node_modules/jest-matcher-utils').RECEIVED_COLOR = require('./expectBundleImpl').RECEIVED_COLOR;
|
||||
export const printReceived: typeof import('../bundles/expect/node_modules/jest-matcher-utils').printReceived = require('./expectBundleImpl').printReceived;
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
import fs from 'fs';
|
||||
import url from 'url';
|
||||
import { transformHook, resolveHook, belongsToNodeModules } from './transform';
|
||||
import { transformHook, resolveHook, belongsToNodeModules } from './common/transform';
|
||||
|
||||
// Node < 18.6: defaultResolve takes 3 arguments.
|
||||
// Node >= 18.6: nextResolve from the chain takes 2 arguments.
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ import type { APIRequestContext, BrowserContext, BrowserContextOptions, LaunchOp
|
|||
import * as playwrightLibrary from 'playwright-core';
|
||||
import { createGuid, debugMode, removeFolders, addStackIgnoreFilter } from 'playwright-core/lib/utils';
|
||||
import type { Fixtures, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, ScreenshotMode, TestInfo, TestType, TraceMode, VideoMode } from '../types/test';
|
||||
import type { TestInfoImpl } from './testInfo';
|
||||
import { rootTestType } from './testType';
|
||||
import { type ContextReuseMode } from './types';
|
||||
export { expect } from './expect';
|
||||
import type { TestInfoImpl } from './common/testInfo';
|
||||
import { rootTestType } from './common/testType';
|
||||
import { type ContextReuseMode } from './common/types';
|
||||
export { expect } from './matchers/expect';
|
||||
export { addRunnerPlugin as _addRunnerPlugin } from './plugins';
|
||||
export const _baseTest: TestType<{}, {}> = rootTestType.test;
|
||||
|
||||
|
|
|
|||
2
packages/playwright-test/src/loader/DEPS.list
Normal file
2
packages/playwright-test/src/loader/DEPS.list
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[*]
|
||||
../common/
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { SerializedConfig } from './ipc';
|
||||
import { ConfigLoader } from './configLoader';
|
||||
import { ProcessRunner } from './process';
|
||||
import { loadTestFilesInProcess } from './testLoader';
|
||||
import type { LoadError } from './fixtures';
|
||||
import type { SerializedConfig } from '../common/ipc';
|
||||
import { ConfigLoader } from '../common/configLoader';
|
||||
import { ProcessRunner } from '../common/process';
|
||||
import { loadTestFilesInProcess } from '../common/testLoader';
|
||||
import type { LoadError } from '../common/fixtures';
|
||||
|
||||
export class LoaderMain extends ProcessRunner {
|
||||
private _config: SerializedConfig;
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
[*]
|
||||
../common/
|
||||
../expect.ts
|
||||
../globals.ts
|
||||
../testInfo.ts
|
||||
|
|
|
|||
|
|
@ -39,17 +39,17 @@ import {
|
|||
toHaveValue,
|
||||
toHaveValues,
|
||||
toPass
|
||||
} from './matchers/matchers';
|
||||
import { toMatchSnapshot, toHaveScreenshot } from './matchers/toMatchSnapshot';
|
||||
import type { Expect } from './types';
|
||||
import { currentTestInfo } from './globals';
|
||||
import { serializeError, captureStackTrace, currentExpectTimeout } from './util';
|
||||
} from './matchers';
|
||||
import { toMatchSnapshot, toHaveScreenshot } from './toMatchSnapshot';
|
||||
import type { Expect } from '../common/types';
|
||||
import { currentTestInfo } from '../common/globals';
|
||||
import { serializeError, captureStackTrace, currentExpectTimeout } from '../util';
|
||||
import {
|
||||
expect as expectLibrary,
|
||||
INVERTED_COLOR,
|
||||
RECEIVED_COLOR,
|
||||
printReceived,
|
||||
} from './expectBundle';
|
||||
} from '../common/expectBundle';
|
||||
|
||||
// from expect/build/types
|
||||
export type SyncExpectationResult = {
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import { colors } from 'playwright-core/lib/utilsBundle';
|
||||
import type { Expect } from '../types';
|
||||
import type { Expect } from '../common/types';
|
||||
|
||||
export function matcherHint(state: ReturnType<Expect['getState']>, matcherName: string, a: any, b: any, matcherOptions: any, timeout?: number) {
|
||||
const message = state.utils.matcherHint(matcherName, a, b, matcherOptions);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
import type { Locator, Page, APIResponse } from 'playwright-core';
|
||||
import type { FrameExpectOptions } from 'playwright-core/lib/client/types';
|
||||
import { colors } from 'playwright-core/lib/utilsBundle';
|
||||
import type { Expect } from '../types';
|
||||
import type { Expect } from '../common/types';
|
||||
import { expectTypes, callLogText } from '../util';
|
||||
import { toBeTruthy } from './toBeTruthy';
|
||||
import { toEqual } from './toEqual';
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Expect } from '../types';
|
||||
import type { Expect } from '../common/types';
|
||||
import type { ParsedStackTrace } from '../util';
|
||||
import { expectTypes, callLogText, currentExpectTimeout, captureStackTrace } from '../util';
|
||||
import { matcherHint } from './matcherHint';
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Expect } from '../types';
|
||||
import type { Expect } from '../common/types';
|
||||
import { expectTypes } from '../util';
|
||||
import { callLogText, currentExpectTimeout } from '../util';
|
||||
import type { ParsedStackTrace } from 'playwright-core/lib/utils';
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
import type { Locator, Page } from 'playwright-core';
|
||||
import type { Page as PageEx } from 'playwright-core/lib/client/page';
|
||||
import type { Locator as LocatorEx } from 'playwright-core/lib/client/locator';
|
||||
import type { Expect } from '../types';
|
||||
import { currentTestInfo } from '../globals';
|
||||
import type { Expect } from '../common/types';
|
||||
import { currentTestInfo } from '../common/globals';
|
||||
import type { ImageComparatorOptions, Comparator } from 'playwright-core/lib/utils';
|
||||
import { getComparator } from 'playwright-core/lib/utils';
|
||||
import type { PageScreenshotOptions } from 'playwright-core/types/types';
|
||||
|
|
@ -30,8 +30,8 @@ import { colors } from 'playwright-core/lib/utilsBundle';
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { mime } from 'playwright-core/lib/utilsBundle';
|
||||
import type { TestInfoImpl } from '../testInfo';
|
||||
import type { SyncExpectationResult } from '../expect';
|
||||
import type { TestInfoImpl } from '../common/testInfo';
|
||||
import type { SyncExpectationResult } from './expect';
|
||||
|
||||
type NameOrSegments = string | string[];
|
||||
const snapshotNamesSymbol = Symbol('snapshotNames');
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@
|
|||
|
||||
import type { ExpectedTextValue } from '@protocol/channels';
|
||||
import { isRegExp, isString } from 'playwright-core/lib/utils';
|
||||
import type { Expect } from '../types';
|
||||
import type { Expect } from '../common/types';
|
||||
import type { ParsedStackTrace } from '../util';
|
||||
import { expectTypes, callLogText, currentExpectTimeout, captureStackTrace } from '../util';
|
||||
import {
|
||||
printReceivedStringContainExpectedResult,
|
||||
printReceivedStringContainExpectedSubstring
|
||||
} from '../expect';
|
||||
} from './expect';
|
||||
import { matcherHint } from './matcherHint';
|
||||
|
||||
export async function toMatchText(
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Fixtures, Locator, Page, BrowserContextOptions, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, BrowserContext, ContextReuseMode } from './types';
|
||||
import type { Fixtures, Locator, Page, BrowserContextOptions, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, BrowserContext, ContextReuseMode } from './common/types';
|
||||
import type { Component, JsxComponent, MountOptions } from '../types/component';
|
||||
|
||||
let boundCallbacksForMount: Function[] = [];
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
[*]
|
||||
../
|
||||
../common/
|
||||
../util.ts
|
||||
../utilsBundle.ts
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@
|
|||
*/
|
||||
|
||||
import type { Suite, Reporter } from '../../types/testReporter';
|
||||
import type { Runner } from '../runner';
|
||||
import type { FullConfig } from '../types';
|
||||
import type { Runner } from '../runner/runner';
|
||||
import type { FullConfig } from '../common/types';
|
||||
|
||||
export interface TestRunnerPlugin {
|
||||
name: string;
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@ import type { Suite } from '../../types/testReporter';
|
|||
import path from 'path';
|
||||
import type { InlineConfig, Plugin } from 'vite';
|
||||
import type { TestRunnerPlugin } from '.';
|
||||
import { parse, traverse, types as t } from '../babelBundle';
|
||||
import { parse, traverse, types as t } from '../common/babelBundle';
|
||||
import { stoppable } from '../utilsBundle';
|
||||
import type { ComponentInfo } from '../tsxTransform';
|
||||
import { collectComponentUsages, componentInfo } from '../tsxTransform';
|
||||
import type { FullConfig } from '../types';
|
||||
import type { ComponentInfo } from '../common/tsxTransform';
|
||||
import { collectComponentUsages, componentInfo } from '../common/tsxTransform';
|
||||
import type { FullConfig } from '../common/types';
|
||||
import { assert, calculateSha1 } from 'playwright-core/lib/utils';
|
||||
import type { AddressInfo } from 'net';
|
||||
import { getPlaywrightVersion } from 'playwright-core/lib/utils';
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ import { raceAgainstTimeout, launchProcess } from 'playwright-core/lib/utils';
|
|||
|
||||
import type { FullConfig, Reporter } from '../../types/testReporter';
|
||||
import type { TestRunnerPlugin } from '.';
|
||||
import type { FullConfigInternal } from '../types';
|
||||
import { envWithoutExperimentalLoaderOptions } from '../cli';
|
||||
import type { FullConfigInternal } from '../common/types';
|
||||
import { envWithoutExperimentalLoaderOptions } from '../util';
|
||||
|
||||
|
||||
export type WebServerPluginOptions = {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
[*]
|
||||
../common/
|
||||
../babelBundle.ts
|
||||
../test.ts
|
||||
../util.ts
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ import { colors, ms as milliseconds, parseStackTraceLine } from 'playwright-core
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import type { FullConfig, TestCase, Suite, TestResult, TestError, FullResult, TestStep, Location, Reporter } from '../../types/testReporter';
|
||||
import type { FullConfigInternal } from '../types';
|
||||
import { codeFrameColumns } from '../babelBundle';
|
||||
import type { FullConfigInternal } from '../common/types';
|
||||
import { codeFrameColumns } from '../common/babelBundle';
|
||||
import { monotonicTime } from 'playwright-core/lib/utils';
|
||||
|
||||
export type TestResultOutput = { chunk: string | Buffer, type: 'stdout' | 'stderr' };
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import type { JsonAttachment, JsonReport, JsonSuite, JsonTestCase, JsonTestResul
|
|||
import RawReporter from './raw';
|
||||
import { stripAnsiEscapes } from './base';
|
||||
import { getPackageJsonPath, sanitizeForFilePath } from '../util';
|
||||
import type { FullConfigInternal, Metadata } from '../types';
|
||||
import type { FullConfigInternal, Metadata } from '../common/types';
|
||||
import type { ZipFile } from 'playwright-core/lib/zipBundle';
|
||||
import { yazl } from 'playwright-core/lib/zipBundle';
|
||||
import { mime } from 'playwright-core/lib/utilsBundle';
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import type { FullConfig, TestCase, TestError, TestResult, FullResult, TestStep, Reporter } from '../../types/testReporter';
|
||||
import { Suite } from '../test';
|
||||
import { Suite } from '../common/test';
|
||||
|
||||
type StdIOChunk = {
|
||||
type: 'stdout' | 'stderr';
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ import { sanitizeForFilePath } from '../util';
|
|||
import { formatResultFailure } from './base';
|
||||
import { toPosixPath, serializePatterns } from './json';
|
||||
import { MultiMap } from 'playwright-core/lib/utils';
|
||||
import { codeFrameColumns } from '../babelBundle';
|
||||
import type { Metadata } from '../types';
|
||||
import { codeFrameColumns } from '../common/babelBundle';
|
||||
import type { Metadata } from '../common/types';
|
||||
|
||||
export type JsonLocation = Location;
|
||||
export type JsonError = string;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
[*]
|
||||
../
|
||||
../../types.ts
|
||||
../common/
|
||||
../matchers/
|
||||
../reporters/
|
||||
../third_party/
|
||||
../plugins/
|
||||
../util.ts
|
||||
|
|
@ -14,15 +14,15 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { TestBeginPayload, TestEndPayload, DonePayload, TestOutputPayload, StepBeginPayload, StepEndPayload, TeardownErrorsPayload, RunPayload, SerializedConfig } from './ipc';
|
||||
import type { TestResult, Reporter, TestStep, TestError } from '../types/testReporter';
|
||||
import type { Suite } from './test';
|
||||
import type { ConfigLoader } from './configLoader';
|
||||
import type { TestBeginPayload, TestEndPayload, DonePayload, TestOutputPayload, StepBeginPayload, StepEndPayload, TeardownErrorsPayload, RunPayload, SerializedConfig } from '../common/ipc';
|
||||
import type { TestResult, Reporter, TestStep, TestError } from '../../types/testReporter';
|
||||
import type { Suite } from '../common/test';
|
||||
import type { ConfigLoader } from '../common/configLoader';
|
||||
import type { ProcessExitData } from './processHost';
|
||||
import type { TestCase } from './test';
|
||||
import type { TestCase } from '../common/test';
|
||||
import { ManualPromise } from 'playwright-core/lib/utils';
|
||||
import { WorkerHost } from './workerHost';
|
||||
import type { TestGroup } from './runner/testGroups';
|
||||
import type { TestGroup } from './testGroups';
|
||||
|
||||
type TestResultData = {
|
||||
result: TestResult;
|
||||
|
|
@ -16,14 +16,14 @@
|
|||
|
||||
import path from 'path';
|
||||
import type { TestError } from '../../types/testReporter';
|
||||
import type { ConfigLoader } from '../configLoader';
|
||||
import type { LoadError } from '../fixtures';
|
||||
import { LoaderHost } from '../loaderHost';
|
||||
import type { ConfigLoader } from '../common/configLoader';
|
||||
import type { LoadError } from '../common/fixtures';
|
||||
import { LoaderHost } from './loaderHost';
|
||||
import type { Multiplexer } from '../reporters/multiplexer';
|
||||
import { createRootSuite, filterOnly, filterSuite } from '../suiteUtils';
|
||||
import type { Suite, TestCase } from '../test';
|
||||
import { loadTestFilesInProcess } from '../testLoader';
|
||||
import type { FullConfigInternal } from '../types';
|
||||
import { createRootSuite, filterOnly, filterSuite } from '../common/suiteUtils';
|
||||
import type { Suite, TestCase } from '../common/test';
|
||||
import { loadTestFilesInProcess } from '../common/testLoader';
|
||||
import type { FullConfigInternal } from '../common/types';
|
||||
import type { Matcher, TestFileFilter } from '../util';
|
||||
import { createFileMatcher } from '../util';
|
||||
import { collectFilesForProjects, collectProjects } from './projectUtils';
|
||||
|
|
|
|||
|
|
@ -14,14 +14,14 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Reporter, TestError } from '../reporter';
|
||||
import type { SerializedConfig } from './ipc';
|
||||
import type { Reporter, TestError } from '../../reporter';
|
||||
import type { SerializedConfig } from '../common/ipc';
|
||||
import { ProcessHost } from './processHost';
|
||||
import { Suite } from './test';
|
||||
import { Suite } from '../common/test';
|
||||
|
||||
export class LoaderHost extends ProcessHost {
|
||||
constructor() {
|
||||
super(require.resolve('./loaderMain.js'), 'loader');
|
||||
super(require.resolve('../loaderMain.js'), 'loader');
|
||||
}
|
||||
|
||||
async start(config: SerializedConfig) {
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
import child_process from 'child_process';
|
||||
import { EventEmitter } from 'events';
|
||||
import { debug } from 'playwright-core/lib/utilsBundle';
|
||||
import type { ProcessInitParams } from './ipc';
|
||||
import type { ProtocolResponse } from './process';
|
||||
import type { ProcessInitParams } from '../common/ipc';
|
||||
import type { ProtocolResponse } from '../common/process';
|
||||
|
||||
export type ProcessExitData = {
|
||||
unexpectedly: boolean;
|
||||
|
|
@ -43,7 +43,7 @@ export class ProcessHost extends EventEmitter {
|
|||
}
|
||||
|
||||
protected async startRunner(runnerParams: any, inheritStdio: boolean, env: NodeJS.ProcessEnv) {
|
||||
this.process = child_process.fork(require.resolve('./process'), {
|
||||
this.process = child_process.fork(require.resolve('../common/process'), {
|
||||
detached: false,
|
||||
env: { ...process.env, ...env },
|
||||
stdio: inheritStdio ? ['ignore', 'inherit', 'inherit', 'ipc'] : ['ignore', 'ignore', process.env.PW_RUNNER_DEBUG ? 'inherit' : 'ignore', 'ipc'],
|
||||
|
|
@ -18,7 +18,7 @@ import fs from 'fs';
|
|||
import path from 'path';
|
||||
import { minimatch } from 'playwright-core/lib/utilsBundle';
|
||||
import { promisify } from 'util';
|
||||
import type { FullConfigInternal, FullProjectInternal } from '../types';
|
||||
import type { FullConfigInternal, FullProjectInternal } from '../common/types';
|
||||
import type { TestFileFilter } from '../util';
|
||||
import { createFileMatcher, createFileMatcherFromFilters } from '../util';
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
import path from 'path';
|
||||
import type { Reporter, TestError } from '../../types/testReporter';
|
||||
import type { ConfigLoader } from '../configLoader';
|
||||
import type { ConfigLoader } from '../common/configLoader';
|
||||
import { formatError } from '../reporters/base';
|
||||
import DotReporter from '../reporters/dot';
|
||||
import EmptyReporter from '../reporters/empty';
|
||||
|
|
@ -27,8 +27,8 @@ import JUnitReporter from '../reporters/junit';
|
|||
import LineReporter from '../reporters/line';
|
||||
import ListReporter from '../reporters/list';
|
||||
import { Multiplexer } from '../reporters/multiplexer';
|
||||
import type { Suite } from '../test';
|
||||
import type { FullConfigInternal, ReporterDescription } from '../types';
|
||||
import type { Suite } from '../common/test';
|
||||
import type { FullConfigInternal, ReporterDescription } from '../common/types';
|
||||
|
||||
export async function createReporter(configLoader: ConfigLoader, list: boolean) {
|
||||
const defaultReporters: {[key in BuiltInReporter]: new(arg: any) => Reporter} = {
|
||||
|
|
|
|||
|
|
@ -16,37 +16,19 @@
|
|||
*/
|
||||
|
||||
import { monotonicTime } from 'playwright-core/lib/utils';
|
||||
import type { FullResult } from '../types/testReporter';
|
||||
import { ConfigLoader } from './configLoader';
|
||||
import type { TestRunnerPlugin } from './plugins';
|
||||
import { setRunnerToAddPluginsTo } from './plugins';
|
||||
import { dockerPlugin } from './plugins/dockerPlugin';
|
||||
import { webServerPluginsForConfig } from './plugins/webServerPlugin';
|
||||
import { collectFilesForProjects, collectProjects } from './runner/projectUtils';
|
||||
import { createReporter } from './runner/reporters';
|
||||
import { createTaskRunner } from './runner/tasks';
|
||||
import type { TaskRunnerState } from './runner/tasks';
|
||||
import type { Config, FullConfigInternal } from './types';
|
||||
import type { Matcher, TestFileFilter } from './util';
|
||||
|
||||
export type ConfigCLIOverrides = {
|
||||
forbidOnly?: boolean;
|
||||
fullyParallel?: boolean;
|
||||
globalTimeout?: number;
|
||||
maxFailures?: number;
|
||||
outputDir?: string;
|
||||
quiet?: boolean;
|
||||
repeatEach?: number;
|
||||
retries?: number;
|
||||
reporter?: string;
|
||||
shard?: { current: number, total: number };
|
||||
timeout?: number;
|
||||
ignoreSnapshots?: boolean;
|
||||
updateSnapshots?: 'all'|'none'|'missing';
|
||||
workers?: number;
|
||||
projects?: { name: string, use?: any }[],
|
||||
use?: any;
|
||||
};
|
||||
import type { FullResult } from '../../types/testReporter';
|
||||
import { ConfigLoader } from '../common/configLoader';
|
||||
import type { TestRunnerPlugin } from '../plugins';
|
||||
import { setRunnerToAddPluginsTo } from '../plugins';
|
||||
import { dockerPlugin } from '../plugins/dockerPlugin';
|
||||
import { webServerPluginsForConfig } from '../plugins/webServerPlugin';
|
||||
import { collectFilesForProjects, collectProjects } from './projectUtils';
|
||||
import { createReporter } from './reporters';
|
||||
import { createTaskRunner } from './tasks';
|
||||
import type { TaskRunnerState } from './tasks';
|
||||
import type { Config, FullConfigInternal } from '../common/types';
|
||||
import type { Matcher, TestFileFilter } from '../util';
|
||||
import type { ConfigCLIOverrides } from '../common/ipc';
|
||||
|
||||
export type RunOptions = {
|
||||
listOnly: boolean;
|
||||
|
|
@ -16,9 +16,9 @@
|
|||
|
||||
import { debug } from 'playwright-core/lib/utilsBundle';
|
||||
import { ManualPromise, monotonicTime } from 'playwright-core/lib/utils';
|
||||
import type { FullResult, Reporter, TestError } from '../reporter';
|
||||
import type { FullResult, Reporter, TestError } from '../../reporter';
|
||||
import { SigIntWatcher } from './sigIntWatcher';
|
||||
import { serializeError } from './util';
|
||||
import { serializeError } from '../util';
|
||||
|
||||
type TaskTeardown = () => Promise<any> | undefined;
|
||||
export type Task<Context> = (context: Context, errors: TestError[]) => Promise<TaskTeardown | void> | undefined;
|
||||
|
|
@ -18,16 +18,16 @@ import fs from 'fs';
|
|||
import path from 'path';
|
||||
import { promisify } from 'util';
|
||||
import { colors, rimraf } from 'playwright-core/lib/utilsBundle';
|
||||
import type { ConfigLoader } from '../configLoader';
|
||||
import { Dispatcher } from '../dispatcher';
|
||||
import type { ConfigLoader } from '../common/configLoader';
|
||||
import { Dispatcher } from './dispatcher';
|
||||
import type { TestRunnerPlugin } from '../plugins';
|
||||
import type { Multiplexer } from '../reporters/multiplexer';
|
||||
import type { TestGroup } from '../runner/testGroups';
|
||||
import { createTestGroups, filterForShard } from '../runner/testGroups';
|
||||
import type { Task } from '../taskRunner';
|
||||
import { TaskRunner } from '../taskRunner';
|
||||
import type { Suite } from '../test';
|
||||
import type { FullConfigInternal } from '../types';
|
||||
import type { Task } from './taskRunner';
|
||||
import { TaskRunner } from './taskRunner';
|
||||
import type { Suite } from '../common/test';
|
||||
import type { FullConfigInternal } from '../common/types';
|
||||
import { loadAllTests } from './loadUtils';
|
||||
import type { Matcher, TestFileFilter } from '../util';
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { filterSuiteWithOnlySemantics } from '../suiteUtils';
|
||||
import type { Suite, TestCase } from '../test';
|
||||
import { filterSuiteWithOnlySemantics } from '../common/suiteUtils';
|
||||
import type { Suite, TestCase } from '../common/test';
|
||||
|
||||
export type TestGroup = {
|
||||
workerHash: string;
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { TestGroup } from './runner/testGroups';
|
||||
import type { RunPayload, SerializedConfig, WorkerInitParams } from './ipc';
|
||||
import type { TestGroup } from './testGroups';
|
||||
import type { RunPayload, SerializedConfig, WorkerInitParams } from '../common/ipc';
|
||||
import { ProcessHost } from './processHost';
|
||||
|
||||
let lastWorkerIndex = 0;
|
||||
|
|
@ -29,7 +29,7 @@ export class WorkerHost extends ProcessHost {
|
|||
|
||||
constructor(testGroup: TestGroup, parallelIndex: number, config: SerializedConfig) {
|
||||
const workerIndex = lastWorkerIndex++;
|
||||
super(require.resolve('./workerMain.js'), `worker-${workerIndex}`);
|
||||
super(require.resolve('../worker/workerMain.js'), `worker-${workerIndex}`);
|
||||
this.workerIndex = workerIndex;
|
||||
this.parallelIndex = parallelIndex;
|
||||
this._hash = testGroup.workerHash;
|
||||
|
|
@ -20,18 +20,18 @@ import util from 'util';
|
|||
import path from 'path';
|
||||
import url from 'url';
|
||||
import { colors, debug, minimatch } from 'playwright-core/lib/utilsBundle';
|
||||
import type { TestInfoError, Location } from './types';
|
||||
import type { TestInfoError, Location } from './common/types';
|
||||
import { calculateSha1, isRegExp, isString, captureStackTrace as coreCaptureStackTrace } from 'playwright-core/lib/utils';
|
||||
import { isInternalFileName } from 'playwright-core/lib/utils';
|
||||
import { currentTestInfo } from './globals';
|
||||
import { currentTestInfo } from './common/globals';
|
||||
import type { ParsedStackTrace } from 'playwright-core/lib/utils';
|
||||
|
||||
export type { ParsedStackTrace };
|
||||
|
||||
const PLAYWRIGHT_CORE_PATH = path.dirname(require.resolve('playwright-core'));
|
||||
const EXPECT_PATH = require.resolve('./expectBundle');
|
||||
const EXPECT_PATH_IMPL = require.resolve('./expectBundleImpl');
|
||||
const PLAYWRIGHT_TEST_PATH = path.join(__dirname, '..');
|
||||
const EXPECT_PATH = require.resolve('./common/expectBundle');
|
||||
const EXPECT_PATH_IMPL = require.resolve('./common/expectBundleImpl');
|
||||
const PLAYWRIGHT_TEST_PATH = path.join(__dirname, '../..');
|
||||
|
||||
function filterStackTrace(e: Error) {
|
||||
if (process.env.PWDEBUGIMPL)
|
||||
|
|
@ -313,3 +313,15 @@ export function folderIsModule(folder: string): boolean {
|
|||
// Rely on `require` internal caching logic.
|
||||
return require(packageJsonPath).type === 'module';
|
||||
}
|
||||
|
||||
export function experimentalLoaderOption() {
|
||||
return ` --no-warnings --experimental-loader=${url.pathToFileURL(require.resolve('@playwright/test/lib/experimentalLoader')).toString()}`;
|
||||
}
|
||||
|
||||
export function envWithoutExperimentalLoaderOptions(): NodeJS.ProcessEnv {
|
||||
const substring = experimentalLoaderOption();
|
||||
const result = { ...process.env };
|
||||
if (result.NODE_OPTIONS)
|
||||
result.NODE_OPTIONS = result.NODE_OPTIONS.replace(substring, '').trim() || undefined;
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const json5: typeof import('../bundles/utils/node_modules/json5') = require('./utilsBundleImpl').json5;
|
||||
export const json5: typeof import('../bundles/utils/node_modules/json5/lib') = require('./utilsBundleImpl').json5;
|
||||
export const open: typeof import('../bundles/utils/node_modules/open') = require('./utilsBundleImpl').open;
|
||||
export const pirates: typeof import('../bundles/utils/node_modules/pirates') = require('./utilsBundleImpl').pirates;
|
||||
export const sourceMapSupport: typeof import('../bundles/utils/node_modules/@types/source-map-support') = require('./utilsBundleImpl').sourceMapSupport;
|
||||
|
|
|
|||
4
packages/playwright-test/src/worker/DEPS.list
Normal file
4
packages/playwright-test/src/worker/DEPS.list
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[*]
|
||||
../common/
|
||||
../util.ts
|
||||
../utilBundle.ts
|
||||
|
|
@ -16,21 +16,21 @@
|
|||
|
||||
import { colors, rimraf } from 'playwright-core/lib/utilsBundle';
|
||||
import util from 'util';
|
||||
import { debugTest, formatLocation, relativeFilePath, serializeError } from './util';
|
||||
import type { TestBeginPayload, TestEndPayload, RunPayload, DonePayload, WorkerInitParams, TeardownErrorsPayload, TestOutputPayload } from './ipc';
|
||||
import { setCurrentTestInfo } from './globals';
|
||||
import { ConfigLoader } from './configLoader';
|
||||
import type { Suite, TestCase } from './test';
|
||||
import type { Annotation, FullProjectInternal, TestInfoError } from './types';
|
||||
import { FixtureRunner } from './fixtures';
|
||||
import { debugTest, formatLocation, relativeFilePath, serializeError } from '../util';
|
||||
import type { TestBeginPayload, TestEndPayload, RunPayload, DonePayload, WorkerInitParams, TeardownErrorsPayload, TestOutputPayload } from '../common/ipc';
|
||||
import { setCurrentTestInfo } from '../common/globals';
|
||||
import { ConfigLoader } from '../common/configLoader';
|
||||
import type { Suite, TestCase } from '../common/test';
|
||||
import type { Annotation, FullProjectInternal, TestInfoError } from '../common/types';
|
||||
import { FixtureRunner } from '../common/fixtures';
|
||||
import { ManualPromise } from 'playwright-core/lib/utils';
|
||||
import { TestInfoImpl } from './testInfo';
|
||||
import type { TimeSlot } from './timeoutManager';
|
||||
import { TimeoutManager } from './timeoutManager';
|
||||
import { ProcessRunner } from './process';
|
||||
import { TestLoader } from './testLoader';
|
||||
import { buildFileSuiteForProject, filterTestsRemoveEmptySuites } from './suiteUtils';
|
||||
import { PoolBuilder } from './poolBuilder';
|
||||
import { TestInfoImpl } from '../common/testInfo';
|
||||
import type { TimeSlot } from '../common/timeoutManager';
|
||||
import { TimeoutManager } from '../common/timeoutManager';
|
||||
import { ProcessRunner } from '../common/process';
|
||||
import { TestLoader } from '../common/testLoader';
|
||||
import { buildFileSuiteForProject, filterTestsRemoveEmptySuites } from '../common/suiteUtils';
|
||||
import { PoolBuilder } from '../common/poolBuilder';
|
||||
|
||||
const removeFolderAsync = util.promisify(rimraf);
|
||||
|
||||
Loading…
Reference in a new issue