chore: organize imports in packages (#34681)

This commit is contained in:
Pavel Feldman 2025-02-07 14:44:00 -08:00 committed by GitHub
parent 4a7f6a6ef0
commit d5d47f2b6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
111 changed files with 671 additions and 459 deletions

View File

@ -47,7 +47,7 @@ Create `tests/auth.setup.ts` that will prepare authenticated browser state for a
```js title="tests/auth.setup.ts"
import { test as setup, expect } from '@playwright/test';
import path from 'path';
import * as path from 'path';
const authFile = path.join(__dirname, '../playwright/.auth/user.json');
@ -143,8 +143,8 @@ Create `playwright/fixtures.ts` file that will [override `storageState` fixture]
```js title="playwright/fixtures.ts"
import { test as baseTest, expect } from '@playwright/test';
import fs from 'fs';
import path from 'path';
import * as fs from 'fs';
import * as path from 'path';
export * from '@playwright/test';
export const test = baseTest.extend<{}, { workerStorageState: string }>({
@ -348,8 +348,8 @@ Alternatively, in a [worker fixture](#moderate-one-account-per-parallel-worker):
```js title="playwright/fixtures.ts"
import { test as baseTest, request } from '@playwright/test';
import fs from 'fs';
import path from 'path';
import * as fs from 'fs';
import * as path from 'path';
export * from '@playwright/test';
export const test = baseTest.extend<{}, { workerStorageState: string }>({

View File

@ -109,7 +109,7 @@ First, add fixtures that will load the extension:
```js title="fixtures.ts"
import { test as base, chromium, type BrowserContext } from '@playwright/test';
import path from 'path';
import * as path from 'path';
export const test = base.extend<{
context: BrowserContext;

View File

@ -389,7 +389,7 @@ Next, add init script to the page.
```js
import { test, expect } from '@playwright/test';
import path from 'path';
import * as path from 'path';
test.beforeEach(async ({ page }) => {
// Add script for every test in the beforeEach hook.

View File

@ -291,7 +291,7 @@ Here is an example that uses [`method: TestInfo.outputPath`] to create a tempora
```js
import { test, expect } from '@playwright/test';
import fs from 'fs';
import * as fs from 'fs';
test('example test', async ({}, testInfo) => {
const file = testInfo.outputPath('temporary-file.txt');

View File

@ -254,7 +254,7 @@ Returns a path inside the [`property: TestInfo.outputDir`] where the test can sa
```js
import { test, expect } from '@playwright/test';
import fs from 'fs';
import * as fs from 'fs';
test('example test', async ({}, testInfo) => {
const file = testInfo.outputPath('dir', 'temporary-file.txt');

View File

@ -212,7 +212,7 @@ Here is an example that uses [`method: TestInfo.outputPath`] to create a tempora
```js
import { test, expect } from '@playwright/test';
import fs from 'fs';
import * as fs from 'fs';
test('example test', async ({}, testInfo) => {
const file = testInfo.outputPath('temporary-file.txt');

View File

@ -262,7 +262,7 @@ To make environment variables easier to manage, consider something like `.env` f
```js title="playwright.config.ts"
import { defineConfig } from '@playwright/test';
import dotenv from 'dotenv';
import path from 'path';
import * as path from 'path';
// Read from ".env" file.
dotenv.config({ path: path.resolve(__dirname, '.env') });
@ -309,8 +309,8 @@ See for example this CSV file, in our example `input.csv`:
Based on this we'll generate some tests by using the [csv-parse](https://www.npmjs.com/package/csv-parse) library from NPM:
```js title="test.spec.ts"
import fs from 'fs';
import path from 'path';
import * as fs from 'fs';
import * as path from 'path';
import { test } from '@playwright/test';
import { parse } from 'csv-parse/sync';

View File

@ -72,9 +72,9 @@ Using the following, Playwright will run your WebView2 application as a sub-proc
```js title="webView2Test.ts"
import { test as base } from '@playwright/test';
import fs from 'fs';
import os from 'os';
import path from 'path';
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import childProcess from 'child_process';
const EXECUTABLE_PATH = path.join(

View File

@ -233,7 +233,9 @@ export default [{
}],
}
}, {
files: ['packages/playwright-core/**/*.ts'],
files: [
'packages/**/*.ts',
],
rules: {
...importOrderRules
},

View File

@ -14,8 +14,8 @@
* limitations under the License.
*/
import fs from 'fs';
import path from 'path';
import * as fs from 'fs';
import * as path from 'path';
import type { Plugin, UserConfig } from 'vite';
export function bundle(): Plugin {

View File

@ -15,8 +15,8 @@
*/
import { devices, defineConfig } from '@playwright/experimental-ct-react';
import path from 'path';
import url from 'url';
import * as path from 'path';
import * as url from 'url';
export default defineConfig({
testDir: 'src',

View File

@ -14,14 +14,17 @@
* limitations under the License.
*/
import fs from 'fs';
import path from 'path';
import * as fs from 'fs';
import * as path from 'path';
import { Watcher } from 'playwright/lib/fsWatcher';
import type { PluginContext } from 'rollup';
import { source as injectedSource } from './generated/indexSource';
import { createConfig, populateComponentsFromTests, resolveDirs, transformIndexFile, frameworkConfig } from './viteUtils';
import { createConfig, frameworkConfig, populateComponentsFromTests, resolveDirs, transformIndexFile } from './viteUtils';
import type { ComponentRegistry } from './viteUtils';
import type { FullConfig } from 'playwright/test';
import type { PluginContext } from 'rollup';
export async function runDevServer(config: FullConfig): Promise<() => Promise<void>> {
const { registerSourceFile, frameworkPluginFactory } = frameworkConfig(config);

View File

@ -14,13 +14,14 @@
* limitations under the License.
*/
import type { Fixtures, Locator, Page, BrowserContextOptions, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, BrowserContext } from 'playwright/test';
import type { Component, JsxComponent, MountOptions, ObjectComponentOptions } from '../types/component';
import type { ContextReuseMode, FullConfigInternal } from '../../playwright/src/common/config';
import type { ImportRef } from './injected/importRegistry';
import { wrapObject } from './injected/serializers';
import { Router } from './router';
import type { ContextReuseMode, FullConfigInternal } from '../../playwright/src/common/config';
import type { RouterFixture } from '../index';
import type { ImportRef } from './injected/importRegistry';
import type { Component, JsxComponent, MountOptions, ObjectComponentOptions } from '../types/component';
import type { BrowserContext, BrowserContextOptions, Fixtures, Locator, Page, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions } from 'playwright/test';
let boundCallbacksForMount: Function[] = [];

View File

@ -14,10 +14,12 @@
* limitations under the License.
*/
import path from 'path';
import type { T, BabelAPI, PluginObj } from 'playwright/src/transform/babelBundle';
import { types, declare, traverse } from 'playwright/lib/transform/babelBundle';
import * as path from 'path';
import { declare, traverse, types } from 'playwright/lib/transform/babelBundle';
import { setTransformData } from 'playwright/lib/transform/transform';
import type { BabelAPI, PluginObj, T } from 'playwright/src/transform/babelBundle';
const t: typeof T = types;
let jsxComponentNames: Set<string>;

View File

@ -14,25 +14,29 @@
* limitations under the License.
*/
import fs from 'fs';
import type http from 'http';
import type { AddressInfo } from 'net';
import path from 'path';
import * as fs from 'fs';
import * as path from 'path';
import { setExternalDependencies } from 'playwright/lib/transform/compilationCache';
import { resolveHook } from 'playwright/lib/transform/transform';
import { removeDirAndLogToConsole } from 'playwright/lib/util';
import { stoppable } from 'playwright/lib/utilsBundle';
import { assert, calculateSha1, getPlaywrightVersion, isURLAvailable } from 'playwright-core/lib/utils';
import { debug } from 'playwright-core/lib/utilsBundle';
import { setExternalDependencies } from 'playwright/lib/transform/compilationCache';
import { stoppable } from 'playwright/lib/utilsBundle';
import { runDevServer } from './devServer';
import { source as injectedSource } from './generated/indexSource';
import { createConfig, frameworkConfig, hasJSComponents, populateComponentsFromTests, resolveDirs, resolveEndpoint, transformIndexFile } from './viteUtils';
import type { ImportInfo } from './tsxTransform';
import type { ComponentRegistry } from './viteUtils';
import type { TestRunnerPlugin } from '../../playwright/src/plugins';
import type http from 'http';
import type { AddressInfo } from 'net';
import type { FullConfig, Suite } from 'playwright/types/testReporter';
import type { PluginContext } from 'rollup';
import type { Plugin, ResolveFn, ResolvedConfig } from 'vite';
import type { TestRunnerPlugin } from '../../playwright/src/plugins';
import { source as injectedSource } from './generated/indexSource';
import type { ImportInfo } from './tsxTransform';
import type { ComponentRegistry } from './viteUtils';
import { createConfig, frameworkConfig, hasJSComponents, populateComponentsFromTests, resolveDirs, resolveEndpoint, transformIndexFile } from './viteUtils';
import { resolveHook } from 'playwright/lib/transform/transform';
import { runDevServer } from './devServer';
import { removeDirAndLogToConsole } from 'playwright/lib/util';
const log = debug('pw:vite');

View File

@ -14,15 +14,18 @@
* limitations under the License.
*/
import fs from 'fs';
import path from 'path';
import { debug } from 'playwright-core/lib/utilsBundle';
import * as fs from 'fs';
import * as path from 'path';
import { getUserData } from 'playwright/lib/transform/compilationCache';
import { resolveHook } from 'playwright/lib/transform/transform';
import { debug } from 'playwright-core/lib/utilsBundle';
import type { ImportInfo } from './tsxTransform';
import type { PlaywrightTestConfig as BasePlaywrightTestConfig } from 'playwright/types/test';
import type { FullConfig } from 'playwright/types/testReporter';
import type { InlineConfig, Plugin, TransformResult, UserConfig } from 'vite';
import type { ImportInfo } from './tsxTransform';
import { resolveHook } from 'playwright/lib/transform/transform';
const log = debug('pw:vite');

View File

@ -16,10 +16,10 @@
/* eslint-disable no-console */
import playwright from 'playwright';
import Anthropic from '@anthropic-ai/sdk';
import dotenv from 'dotenv';
import browser from '@playwright/experimental-tools/browser';
import dotenv from 'dotenv';
import playwright from 'playwright';
dotenv.config();

View File

@ -16,10 +16,11 @@
/* eslint-disable no-console */
import playwright from 'playwright';
import browser from '@playwright/experimental-tools/browser';
import dotenv from 'dotenv';
import OpenAI from 'openai';
import playwright from 'playwright';
import type { ChatCompletionMessageParam, ChatCompletionTool } from 'openai/resources';
dotenv.config();

View File

@ -16,11 +16,13 @@
/* eslint-disable no-console */
import playwright from 'playwright';
import Anthropic from '@anthropic-ai/sdk';
import computer from '@playwright/experimental-tools/computer-20241022';
import dotenv from 'dotenv';
import computer, { type ToolResult } from '@playwright/experimental-tools/computer-20241022';
import playwright from 'playwright';
import type { BetaImageBlockParam, BetaTextBlockParam } from '@anthropic-ai/sdk/resources/beta/messages/messages';
import type { ToolResult } from '@playwright/experimental-tools/computer-20241022';
dotenv.config();

View File

@ -15,11 +15,13 @@
* limitations under the License.
*/
import type playwright from 'playwright';
import type { JSONSchemaType, ToolDeclaration } from '../../types';
import type { ToolResult } from '../../browser';
import { waitForNetwork } from './utils';
import type { ToolResult } from '../../browser';
import type { JSONSchemaType, ToolDeclaration } from '../../types';
import type playwright from 'playwright';
type LocatorEx = playwright.Locator & {
_generateLocatorString: () => Promise<string>;
};

View File

@ -15,11 +15,13 @@
* limitations under the License.
*/
import type playwright from 'playwright';
import type { JSONSchemaType } from '../../types';
import type { ToolResult } from '../../computer-20241022';
import { waitForNetwork } from './utils';
import type { ToolResult } from '../../computer-20241022';
import type { JSONSchemaType } from '../../types';
import type playwright from 'playwright';
export async function call(page: playwright.Page, toolName: string, input: Record<string, JSONSchemaType>): Promise<ToolResult> {
if (toolName !== 'computer')
throw new Error('Unsupported tool');

View File

@ -15,9 +15,10 @@
* limitations under the License.
*/
import type playwright from 'playwright';
import { ManualPromise } from 'playwright-core/lib/utils';
import type playwright from 'playwright';
export async function waitForNetwork<R>(page: playwright.Page, callback: () => Promise<R>): Promise<R> {
const requests = new Set<playwright.Request>();
let frameNavigated = false;

View File

@ -14,16 +14,18 @@
* limitations under the License.
*/
import path from 'path';
import type { BabelFileResult, NodePath, PluginObj, TransformOptions } from '@babel/core';
import type { TSExportAssignment, ImportDeclaration } from '@babel/types';
import type { TemplateBuilder } from '@babel/template';
import * as path from 'path';
import * as babel from '@babel/core';
import traverseFunction from '@babel/traverse';
import type { BabelFileResult, NodePath, PluginObj, TransformOptions } from '@babel/core';
import type { TemplateBuilder } from '@babel/template';
import type { ImportDeclaration, TSExportAssignment } from '@babel/types';
export { codeFrameColumns } from '@babel/code-frame';
export { declare } from '@babel/helper-plugin-utils';
export { types } from '@babel/core';
import traverseFunction from '@babel/traverse';
export const traverse = traverseFunction;
function babelTransformOptions(isTypeScript: boolean, isModule: boolean, pluginsPrologue: [string, any?][], pluginsEpilogue: [string, any?][]): TransformOptions {

View File

@ -14,11 +14,13 @@
* limitations under the License.
*/
import * as mu from 'jest-matcher-utils';
import * as am from '../third_party/asymmetricMatchers';
import expectLibrary from '../third_party/index';
export const expect = expectLibrary;
export * as mock from 'jest-mock';
import * as am from '../third_party/asymmetricMatchers';
import * as mu from 'jest-matcher-utils';
export const asymmetricMatchers = {
any: am.any,

View File

@ -15,7 +15,9 @@ import {
} from '@jest/expect-utils';
import * as matcherUtils from 'jest-matcher-utils';
import { pluralize } from 'jest-util';
import { getCustomEqualityTesters, getState } from './jestMatchersObject';
import type {
AsymmetricMatcher as AsymmetricMatcherInterface,
MatcherContext,

View File

@ -12,7 +12,9 @@ import {
matcherHint,
pluralize,
} from 'jest-matcher-utils';
import { getState, setState } from './jestMatchersObject';
import type { Expect, ExpectedAssertionsErrors } from './types';
const resetAssertionsLocalState = () => {

View File

@ -9,6 +9,7 @@
import { equals, iterableEquality, subsetEquality } from '@jest/expect-utils';
import * as matcherUtils from 'jest-matcher-utils';
import { isPromise } from 'jest-util';
import {
any,
anything,
@ -38,6 +39,7 @@ import spyMatchers from './spyMatchers';
import toThrowMatchers, {
createMatcher as createThrowMatcher,
} from './toThrowMatchers';
import type {
Expect,
ExpectationResult,
@ -54,8 +56,8 @@ import type {
export type { Tester, TesterContext } from '@jest/expect-utils';
export { AsymmetricMatcher } from './asymmetricMatchers';
export type {
AsyncExpectationResult,
AsymmetricMatchers,
AsyncExpectationResult,
BaseExpect,
Expect,
ExpectationResult,

View File

@ -6,15 +6,17 @@
*
*/
import type { Tester } from '@jest/expect-utils';
import { getType } from 'jest-get-type';
import { AsymmetricMatcher } from './asymmetricMatchers';
import type {
Expect,
MatcherState,
MatchersObject,
SyncExpectationResult,
} from './types';
import type { Tester } from '@jest/expect-utils';
// Global matchers object holds the list of available matchers and
// the state, that can hold matcher specific values that change over time.

View File

@ -23,7 +23,7 @@ import { getType, isPrimitive } from 'jest-get-type';
import {
DIM_COLOR,
EXPECTED_COLOR,
type MatcherHintOptions,
RECEIVED_COLOR,
SUGGEST_TO_CONTAIN_EQUAL,
ensureExpectedIsNonNegativeInteger,
@ -36,8 +36,9 @@ import {
printExpected,
printReceived,
printWithType,
stringify,
stringify
} from 'jest-matcher-utils';
import {
printCloseTo,
printExpectedConstructorName,
@ -48,7 +49,9 @@ import {
printReceivedStringContainExpectedResult,
printReceivedStringContainExpectedSubstring,
} from './print';
import type { MatchersObject } from './types';
import type { MatcherHintOptions } from 'jest-matcher-utils';
// Omit colon and one or more spaces, so can call getLabelPrinter.
const EXPECTED_LABEL = 'Expected';

View File

@ -10,7 +10,7 @@ import { getType, isPrimitive } from 'jest-get-type';
import {
DIM_COLOR,
EXPECTED_COLOR,
type MatcherHintOptions,
RECEIVED_COLOR,
diff,
ensureExpectedIsNonNegativeInteger,
@ -20,14 +20,17 @@ import {
printExpected,
printReceived,
printWithType,
stringify,
stringify
} from 'jest-matcher-utils';
import { getCustomEqualityTesters } from './jestMatchersObject';
import type {
MatcherFunction,
MatchersObject,
SyncExpectationResult,
} from './types';
import type { MatcherHintOptions } from 'jest-matcher-utils';
/* eslint-disable eqeqeq */

View File

@ -9,16 +9,17 @@
import { isError } from '@jest/expect-utils';
import {
EXPECTED_COLOR,
type MatcherHintOptions,
RECEIVED_COLOR,
matcherErrorMessage,
matcherHint,
printDiffOrStringify,
printExpected,
printReceived,
printWithType,
printWithType
} from 'jest-matcher-utils';
import { formatStackTrace, separateMessageFromStack } from 'jest-message-util';
import {
printExpectedConstructorName,
printExpectedConstructorNameNot,
@ -27,12 +28,14 @@ import {
printReceivedStringContainExpectedResult,
printReceivedStringContainExpectedSubstring,
} from './print';
import type {
ExpectationResult,
MatcherFunction,
MatchersObject,
SyncExpectationResult,
} from './types';
import type { MatcherHintOptions } from 'jest-matcher-utils';
/* eslint-disable eqeqeq */

View File

@ -6,9 +6,9 @@
*
*/
import type { INTERNAL_MATCHER_FLAG } from './jestMatchersObject';
import type { EqualsFunction, Tester } from '@jest/expect-utils';
import type * as jestMatcherUtils from 'jest-matcher-utils';
import type { INTERNAL_MATCHER_FLAG } from './jestMatchersObject';
export type SyncExpectationResult = {
pass: boolean;

View File

@ -14,6 +14,8 @@
* limitations under the License.
*/
/* eslint-disable import/order */
import json5Library from 'json5';
export const json5 = json5Library;

View File

@ -14,15 +14,17 @@
* limitations under the License.
*/
import fs from 'fs';
import path from 'path';
import os from 'os';
import type { Config, Fixtures, Project, ReporterDescription } from '../../types/test';
import type { Location } from '../../types/testReporter';
import type { TestRunnerPluginRegistration } from '../plugins';
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import { getPackageJsonPath, mergeObjects } from '../util';
import type { Config, Fixtures, Project, ReporterDescription } from '../../types/test';
import type { TestRunnerPluginRegistration } from '../plugins';
import type { Matcher } from '../util';
import type { ConfigCLIOverrides } from './ipc';
import type { Location } from '../../types/testReporter';
import type { FullConfig, FullProject } from '../../types/testReporter';
export type ConfigLocation = {

View File

@ -16,17 +16,20 @@
import * as fs from 'fs';
import * as path from 'path';
import { gracefullyProcessExitDoNotHang, isRegExp } from 'playwright-core/lib/utils';
import type { ConfigCLIOverrides, SerializedConfig } from './ipc';
import { requireOrImport, setSingleTSConfig, setTransformConfig } from '../transform/transform';
import type { Config, Project } from '../../types/test';
import { errorWithFile, fileIsModule } from '../util';
import type { ConfigLocation } from './config';
import { FullConfigInternal } from './config';
import { addToCompilationCache } from '../transform/compilationCache';
import { configureESMLoader, configureESMLoaderTransformConfig, registerESMLoader } from './esmLoaderHost';
import { addToCompilationCache } from '../transform/compilationCache';
import { execArgvWithExperimentalLoaderOptions, execArgvWithoutExperimentalLoaderOptions } from '../transform/esmUtils';
import type { ConfigLocation } from './config';
import type { ConfigCLIOverrides, SerializedConfig } from './ipc';
import type { Config, Project } from '../../types/test';
const kDefineConfigWasUsed = Symbol('defineConfigWasUsed');
export const defineConfig = (...configs: any[]) => {
let result = configs[0];

View File

@ -14,10 +14,11 @@
* limitations under the License.
*/
import url from 'url';
import * as url from 'url';
import { addToCompilationCache, serializeCompilationCache } from '../transform/compilationCache';
import { singleTSConfig, transformConfig } from '../transform/transform';
import { PortTransport } from '../transform/portTransport';
import { singleTSConfig, transformConfig } from '../transform/transform';
let loaderChannel: PortTransport | undefined;
// Node.js < 20

View File

@ -14,11 +14,13 @@
* limitations under the License.
*/
import { filterStackFile, formatLocation } from '../util';
import * as crypto from 'crypto';
import { filterStackFile, formatLocation } from '../util';
import type { FixturesWithLocation } from './config';
import type { Fixtures } from '../../types/test';
import type { Location } from '../../types/testReporter';
import type { FixturesWithLocation } from './config';
export type FixtureScope = 'test' | 'worker';
type FixtureAuto = boolean | 'all-hooks-included';

View File

@ -14,8 +14,8 @@
* limitations under the License.
*/
import type { TestInfoImpl } from '../worker/testInfo';
import type { Suite } from './test';
import type { TestInfoImpl } from '../worker/testInfo';
let currentTestInfoValue: TestInfoImpl | null = null;
export function setCurrentTestInfo(testInfo: TestInfoImpl | null) {

View File

@ -15,11 +15,13 @@
*/
import util from 'util';
import { serializeCompilationCache } from '../transform/compilationCache';
import type { SerializedCompilationCache } from '../transform/compilationCache';
import type { ConfigLocation, FullConfigInternal } from './config';
import type { ReporterDescription, TestInfoError, TestStatus } from '../../types/test';
import type { MatcherResultProperty } from '../matchers/matcherHint';
import type { SerializedCompilationCache } from '../transform/compilationCache';
export type ConfigCLIOverrides = {
debug?: boolean;

View File

@ -15,11 +15,12 @@
*/
import { FixturePool } from './fixtures';
import { formatLocation } from '../util';
import type { FullProjectInternal } from './config';
import type { LoadError } from './fixtures';
import type { Suite, TestCase } from './test';
import type { TestTypeImpl } from './testType';
import type { FullProjectInternal } from './config';
import { formatLocation } from '../util';
import type { TestError } from '../../types/testReporter';
export class PoolBuilder {

View File

@ -14,12 +14,14 @@
* limitations under the License.
*/
import type { EnvProducedPayload, ProcessInitParams, TestInfoErrorImpl } from './ipc';
import { startProfiling, stopProfiling } from 'playwright-core/lib/utils';
import { serializeError } from '../util';
import { registerESMLoader } from './esmLoaderHost';
import { execArgvWithoutExperimentalLoaderOptions } from '../transform/esmUtils';
import type { EnvProducedPayload, ProcessInitParams, TestInfoErrorImpl } from './ipc';
export type ProtocolRequest = {
id: number;
method: string;

View File

@ -14,13 +14,16 @@
* limitations under the License.
*/
import path from 'path';
import * as path from 'path';
import { calculateSha1, toPosixPath } from 'playwright-core/lib/utils';
import type { Suite, TestCase } from './test';
import type { FullProjectInternal } from './config';
import type { Matcher, TestFileFilter } from '../util';
import { createFileMatcher } from '../util';
import type { FullProjectInternal } from './config';
import type { Suite, TestCase } from './test';
import type { Matcher, TestFileFilter } from '../util';
export function filterSuite(suite: Suite, suiteFilter: (suites: Suite) => boolean, testFilter: (test: TestCase) => boolean) {
for (const child of suite.suites) {

View File

@ -14,14 +14,16 @@
* limitations under the License.
*/
import type { FixturePool } from './fixtures';
import type * as reporterTypes from '../../types/testReporter';
import type { TestTypeImpl } from './testType';
import { rootTestType } from './testType';
import type { Annotation, FixturesWithLocation, FullProjectInternal } from './config';
import type { Location, FullProject } from '../../types/testReporter';
import { computeTestCaseOutcome } from '../isomorphic/teleReceiver';
import type { Annotation, FixturesWithLocation, FullProjectInternal } from './config';
import type { FixturePool } from './fixtures';
import type { TestTypeImpl } from './testType';
import type * as reporterTypes from '../../types/testReporter';
import type { FullProject, Location } from '../../types/testReporter';
class Base {
title: string;
_only = false;

View File

@ -14,15 +14,17 @@
* limitations under the License.
*/
import path from 'path';
import * as path from 'path';
import util from 'util';
import type { TestError } from '../../types/testReporter';
import * as esmLoaderHost from './esmLoaderHost';
import { isWorkerProcess, setCurrentlyLoadingFileSuite } from './globals';
import { Suite } from './test';
import { startCollectingFileDeps, stopCollectingFileDeps } from '../transform/compilationCache';
import { requireOrImport } from '../transform/transform';
import { filterStackTrace } from '../util';
import { startCollectingFileDeps, stopCollectingFileDeps } from '../transform/compilationCache';
import * as esmLoaderHost from './esmLoaderHost';
import type { TestError } from '../../types/testReporter';
export const defaultTimeout = 30000;

View File

@ -14,15 +14,18 @@
* limitations under the License.
*/
import { expect } from '../matchers/expect';
import { currentlyLoadingFileSuite, currentTestInfo, setCurrentlyLoadingFileSuite } from './globals';
import { TestCase, Suite } from './test';
import { wrapFunctionWithLocation } from '../transform/transform';
import type { FixturesWithLocation } from './config';
import type { Fixtures, TestType, TestDetails, TestStepInfo } from '../../types/test';
import type { Location } from '../../types/testReporter';
import { getPackageManagerExecCommand, monotonicTime, raceAgainstDeadline, zones } from 'playwright-core/lib/utils';
import { errors } from 'playwright-core';
import { getPackageManagerExecCommand, monotonicTime, raceAgainstDeadline, zones } from 'playwright-core/lib/utils';
import { currentTestInfo, currentlyLoadingFileSuite, setCurrentlyLoadingFileSuite } from './globals';
import { Suite, TestCase } from './test';
import { expect } from '../matchers/expect';
import { wrapFunctionWithLocation } from '../transform/transform';
import type { FixturesWithLocation } from './config';
import type { Fixtures, TestDetails, TestStepInfo, TestType } from '../../types/test';
import type { Location } from '../../types/testReporter';
const testTypeSymbol = Symbol('testType');

View File

@ -15,6 +15,7 @@
*/
import { chokidar } from './utilsBundle';
import type { FSWatcher } from 'chokidar';
export type FSEvent = { event: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir', file: string };

View File

@ -16,16 +16,19 @@
import * as fs from 'fs';
import * as path from 'path';
import type { APIRequestContext, BrowserContext, Browser, BrowserContextOptions, LaunchOptions, Page, Tracing, Video } from 'playwright-core';
import * as playwrightLibrary from 'playwright-core';
import { createGuid, debugMode, addInternalStackPrefix, isString, asLocator, jsonStringifyForceASCII, zones } from 'playwright-core/lib/utils';
import type { Fixtures, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, ScreenshotMode, TestInfo, TestType, VideoMode } from '../types/test';
import type { TestInfoImpl, TestStepInternal } from './worker/testInfo';
import { addInternalStackPrefix, asLocator, createGuid, debugMode, isString, jsonStringifyForceASCII, zones } from 'playwright-core/lib/utils';
import { currentTestInfo } from './common/globals';
import { rootTestType } from './common/testType';
import type { Fixtures, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, ScreenshotMode, TestInfo, TestType, VideoMode } from '../types/test';
import type { ContextReuseMode } from './common/config';
import type { TestInfoImpl, TestStepInternal } from './worker/testInfo';
import type { ApiCallData, ClientInstrumentation, ClientInstrumentationListener } from '../../playwright-core/src/client/clientInstrumentation';
import type { Playwright as PlaywrightImpl } from '../../playwright-core/src/client/playwright';
import { currentTestInfo } from './common/globals';
import type { APIRequestContext, Browser, BrowserContext, BrowserContextOptions, LaunchOptions, Page, Tracing, Video } from 'playwright-core';
export { expect } from './matchers/expect';
export const _baseTest: TestType<{}, {}> = rootTestType.test;

View File

@ -14,7 +14,8 @@
* limitations under the License.
*/
import path from 'path';
import * as path from 'path';
import { fileDependenciesForTest } from './transform/compilationCache';
export function fileDependencies() {

View File

@ -14,9 +14,9 @@
* limitations under the License.
*/
import type { Annotation } from '../common/config';
import type { Metadata } from '../../types/test';
import type * as reporterTypes from '../../types/testReporter';
import type { Annotation } from '../common/config';
import type { ReporterV2 } from '../reporters/reporterV2';
export type StringIntern = (s: string) => string;

View File

@ -16,8 +16,9 @@
import { TeleReporterReceiver, TeleSuite } from './teleReceiver';
import { statusEx } from './testTree';
import type { ReporterV2 } from '../reporters/reporterV2';
import type * as reporterTypes from '../../types/testReporter';
import type { ReporterV2 } from '../reporters/reporterV2';
export type TeleSuiteUpdaterProgress = {
total: number;

View File

@ -14,9 +14,10 @@
* limitations under the License.
*/
import type { TestServerInterface, TestServerInterfaceEvents } from '@testIsomorphic/testServerInterface';
import * as events from './events';
import type { TestServerInterface, TestServerInterfaceEvents } from '@testIsomorphic/testServerInterface';
// -- Reuse boundary -- Everything below this line is reused in the vscode extension.
export interface TestServerTransport {

View File

@ -14,9 +14,9 @@
* limitations under the License.
*/
import type * as reporterTypes from '../../types/testReporter';
import type { Event } from './events';
import type { JsonEvent } from './teleReceiver';
import type * as reporterTypes from '../../types/testReporter';
// -- Reuse boundary -- Everything below this line is reused in the vscode extension.

View File

@ -14,15 +14,16 @@
* limitations under the License.
*/
import type { SerializedConfig } from '../common/ipc';
import { deserializeConfig } from '../common/configLoader';
import { ProcessRunner } from '../common/process';
import type { FullConfigInternal } from '../common/config';
import { loadTestFile } from '../common/testLoader';
import type { TestError } from '../../types/testReporter';
import { serializeCompilationCache } from '../transform/compilationCache';
import { PoolBuilder } from '../common/poolBuilder';
import { incorporateCompilationCache } from '../common/esmLoaderHost';
import { PoolBuilder } from '../common/poolBuilder';
import { ProcessRunner } from '../common/process';
import { loadTestFile } from '../common/testLoader';
import { serializeCompilationCache } from '../transform/compilationCache';
import type { TestError } from '../../types/testReporter';
import type { FullConfigInternal } from '../common/config';
import type { SerializedConfig } from '../common/ipc';
export class LoaderMain extends ProcessRunner {
private _serializedConfig: SerializedConfig;

View File

@ -19,6 +19,9 @@ import {
createGuid,
isString,
pollAgainstDeadline } from 'playwright-core/lib/utils';
import { zones } from 'playwright-core/lib/utils';
import { ExpectError, isJestError } from './matcherHint';
import {
toBeAttached,
toBeChecked,
@ -33,12 +36,12 @@ import {
toBeVisible,
toContainText,
toHaveAccessibleDescription,
toHaveAccessibleName,
toHaveAccessibleErrorMessage,
toHaveAccessibleName,
toHaveAttribute,
toHaveCSS,
toHaveClass,
toHaveCount,
toHaveCSS,
toHaveId,
toHaveJSProperty,
toHaveRole,
@ -49,22 +52,22 @@ import {
toHaveValues,
toPass
} from './matchers';
import type { ExpectMatcherStateInternal } from './matchers';
import { toMatchSnapshot, toHaveScreenshot, toHaveScreenshotStepTitle } from './toMatchSnapshot';
import type { Expect } from '../../types/test';
import { currentTestInfo } from '../common/globals';
import { filteredStackTrace, trimLongString } from '../util';
import { toMatchAriaSnapshot } from './toMatchAriaSnapshot';
import { toHaveScreenshot, toHaveScreenshotStepTitle, toMatchSnapshot } from './toMatchSnapshot';
import {
expect as expectLibrary,
INVERTED_COLOR,
RECEIVED_COLOR,
expect as expectLibrary,
printReceived,
} from '../common/expectBundle';
import { zones } from 'playwright-core/lib/utils';
import { currentTestInfo } from '../common/globals';
import { filteredStackTrace, trimLongString } from '../util';
import { TestInfoImpl } from '../worker/testInfo';
import type { ExpectMatcherStateInternal } from './matchers';
import type { Expect } from '../../types/test';
import type { TestStepInfoImpl } from '../worker/testInfo';
import { ExpectError, isJestError } from './matcherHint';
import { toMatchAriaSnapshot } from './toMatchAriaSnapshot';
// #region
// Mirrored from https://github.com/facebook/jest/blob/f13abff8df9a0e1148baf3584bcde6d1b479edc7/packages/expect/src/print.ts

View File

@ -14,11 +14,12 @@
* limitations under the License.
*/
import { colors } from 'playwright-core/lib/utilsBundle';
import type { ExpectMatcherState } from '../../types/test';
import type { Locator } from 'playwright-core';
import type { StackFrame } from '@protocol/channels';
import { stringifyStackFrames } from 'playwright-core/lib/utils';
import { colors } from 'playwright-core/lib/utilsBundle';
import type { ExpectMatcherState } from '../../types/test';
import type { StackFrame } from '@protocol/channels';
import type { Locator } from 'playwright-core';
export const kNoElementsFoundError = '<element(s) not found>';

View File

@ -14,20 +14,22 @@
* limitations under the License.
*/
import type { Locator, Page, APIResponse } from 'playwright-core';
import type { FrameExpectParams } from 'playwright-core/lib/client/types';
import { isRegExp, isString, isTextualMimeType, pollAgainstDeadline, serializeExpectedTextValues } from 'playwright-core/lib/utils';
import { colors } from 'playwright-core/lib/utilsBundle';
import { expectTypes, callLogText } from '../util';
import { callLogText, expectTypes } from '../util';
import { toBeTruthy } from './toBeTruthy';
import { toEqual } from './toEqual';
import { toHaveURL as toHaveURLExternal } from './toHaveURL';
import { toMatchText } from './toMatchText';
import { isRegExp, isString, isTextualMimeType, pollAgainstDeadline, serializeExpectedTextValues } from 'playwright-core/lib/utils';
import { takeFirst } from '../common/config';
import { currentTestInfo } from '../common/globals';
import { TestInfoImpl } from '../worker/testInfo';
import type { TestStepInfoImpl } from '../worker/testInfo';
import type { ExpectMatcherState } from '../../types/test';
import { takeFirst } from '../common/config';
import { toHaveURL as toHaveURLExternal } from './toHaveURL';
import type { TestStepInfoImpl } from '../worker/testInfo';
import type { APIResponse, Locator, Page } from 'playwright-core';
import type { FrameExpectParams } from 'playwright-core/lib/client/types';
export type ExpectMatcherStateInternal = ExpectMatcherState & { _stepInfo?: TestStepInfoImpl };

View File

@ -14,8 +14,9 @@
* limitations under the License.
*/
import { expectTypes, callLogText } from '../util';
import { callLogText, expectTypes } from '../util';
import { kNoElementsFoundError, matcherHint } from './matcherHint';
import type { MatcherResult } from './matcherHint';
import type { ExpectMatcherState } from '../../types/test';
import type { Locator } from 'playwright-core';

View File

@ -14,12 +14,14 @@
* limitations under the License.
*/
import { expectTypes, callLogText } from '../util';
import { isRegExp } from 'playwright-core/lib/utils';
import { callLogText, expectTypes } from '../util';
import { matcherHint } from './matcherHint';
import type { MatcherResult } from './matcherHint';
import type { ExpectMatcherState } from '../../types/test';
import type { Locator } from 'playwright-core';
import { isRegExp } from 'playwright-core/lib/utils';
// Omit colon and one or more spaces, so can call getLabelPrinter.
const EXPECTED_LABEL = 'Expected';

View File

@ -14,13 +14,16 @@
* limitations under the License.
*/
import type { Page } from 'playwright-core';
import type { ExpectMatcherState } from '../../types/test';
import { EXPECTED_COLOR, printReceived } from '../common/expectBundle';
import { matcherHint, type MatcherResult } from './matcherHint';
import { constructURLBasedOnBaseURL, urlMatches } from 'playwright-core/lib/utils';
import { colors } from 'playwright-core/lib/utilsBundle';
import { printReceivedStringContainExpectedResult, printReceivedStringContainExpectedSubstring } from './expect';
import { matcherHint } from './matcherHint';
import { EXPECTED_COLOR, printReceived } from '../common/expectBundle';
import type { MatcherResult } from './matcherHint';
import type { ExpectMatcherState } from '../../types/test';
import type { Page } from 'playwright-core';
export async function toHaveURL(
this: ExpectMatcherState,

View File

@ -15,17 +15,22 @@
*/
import type { LocatorEx } from './matchers';
import type { ExpectMatcherState } from '../../types/test';
import { kNoElementsFoundError, matcherHint, type MatcherResult } from './matcherHint';
import * as fs from 'fs';
import * as path from 'path';
import { escapeTemplateString, isString, sanitizeForFilePath } from 'playwright-core/lib/utils';
import { kNoElementsFoundError, matcherHint } from './matcherHint';
import { EXPECTED_COLOR } from '../common/expectBundle';
import { callLogText, sanitizeFilePathBeforeExtension, trimLongString } from '../util';
import { printReceivedStringContainExpectedSubstring } from './expect';
import { currentTestInfo } from '../common/globals';
import type { MatcherResult } from './matcherHint';
import type { LocatorEx } from './matchers';
import type { ExpectMatcherState } from '../../types/test';
import type { MatcherReceived } from '@injected/ariaSnapshot';
import { escapeTemplateString, isString, sanitizeForFilePath } from 'playwright-core/lib/utils';
import fs from 'fs';
import path from 'path';
type ToMatchAriaSnapshotExpected = {
name?: string;

View File

@ -14,25 +14,29 @@
* limitations under the License.
*/
import type { Locator, Page } from 'playwright-core';
import type { ExpectScreenshotOptions, Page as PageEx } from 'playwright-core/lib/client/page';
import { currentTestInfo } from '../common/globals';
import type { ImageComparatorOptions, Comparator } from 'playwright-core/lib/utils';
import * as fs from 'fs';
import * as path from 'path';
import { compareBuffersOrStrings, getComparator, isString, sanitizeForFilePath } from 'playwright-core/lib/utils';
import { colors } from 'playwright-core/lib/utilsBundle';
import { mime } from 'playwright-core/lib/utilsBundle';
import {
addSuffixToFilePath,
trimLongString, callLogText,
addSuffixToFilePath, callLogText,
expectTypes,
sanitizeFilePathBeforeExtension,
trimLongString,
windowsFilesystemFriendlyLength } from '../util';
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, TestStepInfoImpl } from '../worker/testInfo';
import { matcherHint } from './matcherHint';
import { currentTestInfo } from '../common/globals';
import type { MatcherResult } from './matcherHint';
import type { ExpectMatcherStateInternal } from './matchers';
import { matcherHint, type MatcherResult } from './matcherHint';
import type { FullProjectInternal } from '../common/config';
import type { TestInfoImpl, TestStepInfoImpl } from '../worker/testInfo';
import type { Locator, Page } from 'playwright-core';
import type { ExpectScreenshotOptions, Page as PageEx } from 'playwright-core/lib/client/page';
import type { Comparator, ImageComparatorOptions } from 'playwright-core/lib/utils';
type NameOrSegments = string | string[];
const snapshotNamesSymbol = Symbol('snapshotNames');

View File

@ -15,17 +15,19 @@
*/
import { expectTypes, callLogText } from '../util';
import { colors } from 'playwright-core/lib/utilsBundle';
import { callLogText, expectTypes } from '../util';
import {
printReceivedStringContainExpectedResult,
printReceivedStringContainExpectedSubstring
} from './expect';
import { EXPECTED_COLOR } from '../common/expectBundle';
import type { ExpectMatcherState } from '../../types/test';
import { kNoElementsFoundError, matcherHint } from './matcherHint';
import { EXPECTED_COLOR } from '../common/expectBundle';
import type { MatcherResult } from './matcherHint';
import type { ExpectMatcherState } from '../../types/test';
import type { Locator } from 'playwright-core';
import { colors } from 'playwright-core/lib/utilsBundle';
export async function toMatchText(
this: ExpectMatcherState,

View File

@ -15,6 +15,7 @@
*/
import { createGuid, spawnAsync } from 'playwright-core/lib/utils';
import type { TestRunnerPlugin } from './';
import type { FullConfig } from '../../types/testReporter';
import type { FullConfigInternal } from '../common/config';

View File

@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import path from 'path';
import net from 'net';
import * as net from 'net';
import * as path from 'path';
import { isURLAvailable, launchProcess, monotonicTime, raceAgainstDeadline } from 'playwright-core/lib/utils';
import { colors, debug } from 'playwright-core/lib/utilsBundle';
import { raceAgainstDeadline, launchProcess, monotonicTime, isURLAvailable } from 'playwright-core/lib/utils';
import type { FullConfig } from '../../types/testReporter';
import type { TestRunnerPlugin } from '.';
import type { FullConfig } from '../../types/testReporter';
import type { FullConfigInternal } from '../common/config';
import type { ReporterV2 } from '../reporters/reporterV2';

View File

@ -16,25 +16,28 @@
/* eslint-disable no-console */
import type { Command } from 'playwright-core/lib/utilsBundle';
import fs from 'fs';
import path from 'path';
import { Runner } from './runner/runner';
import { stopProfiling, startProfiling, gracefullyProcessExitDoNotHang } from 'playwright-core/lib/utils';
import { serializeError } from './util';
import * as fs from 'fs';
import * as path from 'path';
import { program } from 'playwright-core/lib/cli/program';
import { gracefullyProcessExitDoNotHang, startProfiling, stopProfiling } from 'playwright-core/lib/utils';
import { builtInReporters, defaultReporter, defaultTimeout } from './common/config';
import { loadConfigFromFileRestartIfNeeded, loadEmptyConfigForMergeReports, resolveConfigLocation } from './common/configLoader';
export { program } from 'playwright-core/lib/cli/program';
import { prepareErrorStack } from './reporters/base';
import { showHTMLReport } from './reporters/html';
import { createMergedReport } from './reporters/merge';
import { loadConfigFromFileRestartIfNeeded, loadEmptyConfigForMergeReports, resolveConfigLocation } from './common/configLoader';
import type { ConfigCLIOverrides } from './common/ipc';
import type { TestError } from '../types/testReporter';
import type { TraceMode } from '../types/test';
import { builtInReporters, defaultReporter, defaultTimeout } from './common/config';
import { program } from 'playwright-core/lib/cli/program';
export { program } from 'playwright-core/lib/cli/program';
import type { ReporterDescription } from '../types/test';
import { prepareErrorStack } from './reporters/base';
import { Runner } from './runner/runner';
import * as testServer from './runner/testServer';
import { runWatchModeLoop } from './runner/watchMode';
import { serializeError } from './util';
import type { TestError } from '../types/testReporter';
import type { ConfigCLIOverrides } from './common/ipc';
import type { TraceMode } from '../types/test';
import type { ReporterDescription } from '../types/test';
import type { Command } from 'playwright-core/lib/utilsBundle';
function addTestCommand(program: Command) {
const command = program.command('test [test-filter...]');

View File

@ -14,13 +14,16 @@
* limitations under the License.
*/
import { colors as realColors, ms as milliseconds, parseStackTraceLine } from 'playwright-core/lib/utilsBundle';
import path from 'path';
import type { FullConfig, TestCase, Suite, TestResult, TestError, FullResult, TestStep, Location } from '../../types/testReporter';
import * as path from 'path';
import { getPackageManagerExecCommand } from 'playwright-core/lib/utils';
import { getEastAsianWidth } from '../utilsBundle';
import type { ReporterV2 } from './reporterV2';
import { colors as realColors, ms as milliseconds, parseStackTraceLine } from 'playwright-core/lib/utilsBundle';
import { resolveReporterOutputPath } from '../util';
import { getEastAsianWidth } from '../utilsBundle';
import type { ReporterV2 } from './reporterV2';
import type { FullConfig, FullResult, Location, Suite, TestCase, TestError, TestResult, TestStep } from '../../types/testReporter';
export type TestResultOutput = { chunk: string | Buffer, type: 'stdout' | 'stderr' };
export const kOutputSymbol = Symbol('output');

View File

@ -14,17 +14,20 @@
* limitations under the License.
*/
import fs from 'fs';
import path from 'path';
import * as fs from 'fs';
import * as path from 'path';
import { Readable } from 'stream';
import { ManualPromise, calculateSha1, createGuid, getUserAgent, removeFolders, sanitizeForFilePath } from 'playwright-core/lib/utils';
import { mime } from 'playwright-core/lib/utilsBundle';
import { Readable } from 'stream';
import type { EventEmitter } from 'events';
import { yazl } from 'playwright-core/lib/zipBundle';
import { resolveOutputFile } from './base';
import { TeleReporterEmitter } from './teleEmitter';
import type { FullConfig, FullResult, TestResult } from '../../types/testReporter';
import type { JsonAttachment, JsonEvent } from '../isomorphic/teleReceiver';
import { TeleReporterEmitter } from './teleEmitter';
import { yazl } from 'playwright-core/lib/zipBundle';
import { resolveOutputFile } from './base';
import type { EventEmitter } from 'events';
type BlobReporterOptions = {
configDir: string;

View File

@ -15,7 +15,8 @@
*/
import { TerminalReporter } from './base';
import type { FullResult, TestCase, TestResult, Suite, TestError } from '../../types/testReporter';
import type { FullResult, Suite, TestCase, TestError, TestResult } from '../../types/testReporter';
class DotReporter extends TerminalReporter {
private _counter = 0;

View File

@ -14,10 +14,13 @@
* limitations under the License.
*/
import * as path from 'path';
import { ms as milliseconds } from 'playwright-core/lib/utilsBundle';
import path from 'path';
import { TerminalReporter, formatResultFailure, formatRetry, noColors, stripAnsiEscapes } from './base';
import type { TestCase, FullResult, TestError } from '../../types/testReporter';
import type { FullResult, TestCase, TestError } from '../../types/testReporter';
type GitHubLogType = 'debug' | 'notice' | 'warning' | 'error';

View File

@ -14,23 +14,26 @@
* limitations under the License.
*/
import { colors, open } from 'playwright-core/lib/utilsBundle';
import { MultiMap, getPackageManagerExecCommand } from 'playwright-core/lib/utils';
import fs from 'fs';
import path from 'path';
import type { TransformCallback } from 'stream';
import * as fs from 'fs';
import * as path from 'path';
import { Transform } from 'stream';
import { codeFrameColumns } from '../transform/babelBundle';
import type * as api from '../../types/testReporter';
import { MultiMap, getPackageManagerExecCommand } from 'playwright-core/lib/utils';
import { HttpServer, assert, calculateSha1, copyFileAndMakeWritable, gracefullyProcessExitDoNotHang, removeFolders, sanitizeForFilePath, toPosixPath } from 'playwright-core/lib/utils';
import { formatError, formatResultFailure, internalScreen, stripAnsiEscapes } from './base';
import { resolveReporterOutputPath } from '../util';
import type { Metadata } from '../../types/test';
import type { ZipFile } from 'playwright-core/lib/zipBundle';
import { yazl } from 'playwright-core/lib/zipBundle';
import { colors, open } from 'playwright-core/lib/utilsBundle';
import { mime } from 'playwright-core/lib/utilsBundle';
import type { HTMLReport, Stats, TestAttachment, TestCase, TestCaseSummary, TestFile, TestFileSummary, TestResult, TestStep } from '@html-reporter/types';
import { yazl } from 'playwright-core/lib/zipBundle';
import { formatError, formatResultFailure, internalScreen, stripAnsiEscapes } from './base';
import { codeFrameColumns } from '../transform/babelBundle';
import { resolveReporterOutputPath } from '../util';
import type { ReporterV2 } from './reporterV2';
import type { Metadata } from '../../types/test';
import type * as api from '../../types/testReporter';
import type { HTMLReport, Stats, TestAttachment, TestCase, TestCaseSummary, TestFile, TestFileSummary, TestResult, TestStep } from '@html-reporter/types';
import type { ZipFile } from 'playwright-core/lib/zipBundle';
import type { TransformCallback } from 'stream';
type TestEntry = {
testCase: TestCase;

View File

@ -14,14 +14,18 @@
* limitations under the License.
*/
import fs from 'fs';
import { codeFrameColumns } from '../transform/babelBundle';
import type { FullConfig, TestCase, TestError, TestResult, FullResult, TestStep } from '../../types/testReporter';
import { Suite } from '../common/test';
import { internalScreen, prepareErrorStack, relativeFilePath } from './base';
import type { ReporterV2 } from './reporterV2';
import * as fs from 'fs';
import { monotonicTime } from 'playwright-core/lib/utils';
import { internalScreen, prepareErrorStack, relativeFilePath } from './base';
import { Multiplexer } from './multiplexer';
import { Suite } from '../common/test';
import { codeFrameColumns } from '../transform/babelBundle';
import type { ReporterV2 } from './reporterV2';
import type { FullConfig, FullResult, TestCase, TestError, TestResult, TestStep } from '../../types/testReporter';
export class InternalReporter implements ReporterV2 {
private _reporter: ReporterV2;

View File

@ -14,13 +14,16 @@
* limitations under the License.
*/
import fs from 'fs';
import path from 'path';
import type { FullConfig, TestCase, Suite, TestResult, TestError, TestStep, FullResult, Location, JSONReport, JSONReportSuite, JSONReportSpec, JSONReportTest, JSONReportTestResult, JSONReportTestStep, JSONReportError } from '../../types/testReporter';
import { formatError, nonTerminalScreen, prepareErrorStack, resolveOutputFile } from './base';
import * as fs from 'fs';
import * as path from 'path';
import { MultiMap, toPosixPath } from 'playwright-core/lib/utils';
import { formatError, nonTerminalScreen, prepareErrorStack, resolveOutputFile } from './base';
import { getProjectId } from '../common/config';
import type { ReporterV2 } from './reporterV2';
import type { FullConfig, FullResult, JSONReport, JSONReportError, JSONReportSpec, JSONReportSuite, JSONReportTest, JSONReportTestResult, JSONReportTestStep, Location, Suite, TestCase, TestError, TestResult, TestStep } from '../../types/testReporter';
type JSONOptions = {
outputFile?: string,

View File

@ -14,12 +14,15 @@
* limitations under the License.
*/
import fs from 'fs';
import path from 'path';
import type { FullConfig, FullResult, Suite, TestCase } from '../../types/testReporter';
import { formatFailure, nonTerminalScreen, resolveOutputFile, stripAnsiEscapes } from './base';
import * as fs from 'fs';
import * as path from 'path';
import { getAsBooleanFromENV } from 'playwright-core/lib/utils';
import { formatFailure, nonTerminalScreen, resolveOutputFile, stripAnsiEscapes } from './base';
import type { ReporterV2 } from './reporterV2';
import type { FullConfig, FullResult, Suite, TestCase } from '../../types/testReporter';
type JUnitOptions = {
outputFile?: string,

View File

@ -15,7 +15,8 @@
*/
import { TerminalReporter } from './base';
import type { TestCase, Suite, TestResult, FullResult, TestStep, TestError } from '../../types/testReporter';
import type { FullResult, Suite, TestCase, TestError, TestResult, TestStep } from '../../types/testReporter';
class LineReporter extends TerminalReporter {
private _current = 0;

View File

@ -14,10 +14,12 @@
* limitations under the License.
*/
import { ms as milliseconds } from 'playwright-core/lib/utilsBundle';
import { TerminalReporter, stepSuffix, stripAnsiEscapes } from './base';
import type { FullResult, Suite, TestCase, TestError, TestResult, TestStep } from '../../types/testReporter';
import { getAsBooleanFromENV } from 'playwright-core/lib/utils';
import { ms as milliseconds } from 'playwright-core/lib/utilsBundle';
import { TerminalReporter, stepSuffix, stripAnsiEscapes } from './base';
import type { FullResult, Suite, TestCase, TestError, TestResult, TestStep } from '../../types/testReporter';
// Allow it in the Visual Studio Code Terminal and the new Windows Terminal
const DOES_NOT_SUPPORT_UTF8_IN_TERMINAL = process.platform === 'win32' && process.env.TERM_PROGRAM !== 'vscode' && !process.env.WT_SESSION;

View File

@ -14,12 +14,14 @@
* limitations under the License.
*/
import fs from 'fs';
import path from 'path';
import type { FullResult, TestCase } from '../../types/testReporter';
import * as fs from 'fs';
import * as path from 'path';
import { resolveReporterOutputPath } from '../util';
import { TerminalReporter } from './base';
import type { FullResult, TestCase } from '../../types/testReporter';
type MarkdownReporterOptions = {
configDir: string,
outputFile?: string;

View File

@ -14,19 +14,23 @@
* limitations under the License.
*/
import fs from 'fs';
import path from 'path';
import type { ReporterDescription } from '../../types/test';
import type { FullConfigInternal } from '../common/config';
import type { JsonConfig, JsonEvent, JsonFullResult, JsonLocation, JsonProject, JsonSuite, JsonTestCase, JsonTestResultEnd, JsonTestStepStart, JsonTestStepEnd } from '../isomorphic/teleReceiver';
import { TeleReporterReceiver } from '../isomorphic/teleReceiver';
import { JsonStringInternalizer, StringInternPool } from '../isomorphic/stringInternPool';
import { createReporters } from '../runner/reporters';
import { Multiplexer } from './multiplexer';
import * as fs from 'fs';
import * as path from 'path';
import { ZipFile } from 'playwright-core/lib/utils';
import { currentBlobReportVersion, type BlobReportMetadata } from './blob';
import { currentBlobReportVersion } from './blob';
import { Multiplexer } from './multiplexer';
import { JsonStringInternalizer, StringInternPool } from '../isomorphic/stringInternPool';
import { TeleReporterReceiver } from '../isomorphic/teleReceiver';
import { createReporters } from '../runner/reporters';
import { relativeFilePath } from '../util';
import type { BlobReportMetadata } from './blob';
import type { ReporterDescription } from '../../types/test';
import type { TestError } from '../../types/testReporter';
import type { FullConfigInternal } from '../common/config';
import type { JsonConfig, JsonEvent, JsonFullResult, JsonLocation, JsonProject, JsonSuite, JsonTestCase, JsonTestResultEnd, JsonTestStepEnd, JsonTestStepStart } from '../isomorphic/teleReceiver';
import type * as blobV1 from './versions/blobV1';
type StatusCallback = (message: string) => void;

View File

@ -14,9 +14,9 @@
* limitations under the License.
*/
import type { FullConfig, TestCase, TestError, TestResult, FullResult, TestStep } from '../../types/testReporter';
import type { Suite } from '../common/test';
import type { ReporterV2 } from './reporterV2';
import type { FullConfig, FullResult, TestCase, TestError, TestResult, TestStep } from '../../types/testReporter';
import type { Suite } from '../common/test';
export class Multiplexer implements ReporterV2 {
private _reporters: ReporterV2[];

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import type { FullConfig, TestCase, TestError, TestResult, FullResult, TestStep, Reporter, Suite } from '../../types/testReporter';
import type { FullConfig, FullResult, Reporter, Suite, TestCase, TestError, TestResult, TestStep } from '../../types/testReporter';
export interface ReporterV2 {
onConfigure?(config: FullConfig): void;

View File

@ -14,12 +14,15 @@
* limitations under the License.
*/
import path from 'path';
import * as path from 'path';
import { createGuid } from 'playwright-core/lib/utils';
import { serializeRegexPatterns } from '../isomorphic/teleReceiver';
import type { ReporterV2 } from './reporterV2';
import type * as reporterTypes from '../../types/testReporter';
import type * as teleReceiver from '../isomorphic/teleReceiver';
import { serializeRegexPatterns } from '../isomorphic/teleReceiver';
import type { ReporterV2 } from './reporterV2';
export type TeleReporterEmitterOptions = {
omitOutput?: boolean;

View File

@ -14,20 +14,24 @@
* limitations under the License.
*/
import type { TestBeginPayload, TestEndPayload, DonePayload, TestOutputPayload, StepBeginPayload, StepEndPayload, TeardownErrorsPayload, RunPayload, SerializedConfig, AttachmentPayload } from '../common/ipc';
import { serializeConfig } from '../common/ipc';
import type { TestResult, TestStep, TestError } from '../../types/testReporter';
import type { Suite } from '../common/test';
import type { ProcessExitData } from './processHost';
import type { TestCase } from '../common/test';
import { ManualPromise, type RegisteredListener, eventsHelper } from 'playwright-core/lib/utils';
import { WorkerHost } from './workerHost';
import type { TestGroup } from './testGroups';
import type { FullConfigInternal } from '../common/config';
import type { ReporterV2 } from '../reporters/reporterV2';
import type { FailureTracker } from './failureTracker';
import { ManualPromise, eventsHelper } from 'playwright-core/lib/utils';
import { colors } from 'playwright-core/lib/utilsBundle';
import { addSuggestedRebaseline } from './rebase';
import { WorkerHost } from './workerHost';
import { serializeConfig } from '../common/ipc';
import type { FailureTracker } from './failureTracker';
import type { ProcessExitData } from './processHost';
import type { TestGroup } from './testGroups';
import type { TestError, TestResult, TestStep } from '../../types/testReporter';
import type { FullConfigInternal } from '../common/config';
import type { AttachmentPayload, DonePayload, RunPayload, SerializedConfig, StepBeginPayload, StepEndPayload, TeardownErrorsPayload, TestBeginPayload, TestEndPayload, TestOutputPayload } from '../common/ipc';
import type { Suite } from '../common/test';
import type { TestCase } from '../common/test';
import type { ReporterV2 } from '../reporters/reporterV2';
import type { RegisteredListener } from 'playwright-core/lib/utils';
export type EnvByProjectId = Map<string, Record<string, string | undefined>>;

View File

@ -14,10 +14,12 @@
* limitations under the License.
*/
import fs from 'fs';
import path from 'path';
import type { FullResult, Suite } from '../../types/testReporter';
import * as fs from 'fs';
import * as path from 'path';
import { filterProjects } from './projectUtils';
import type { FullResult, Suite } from '../../types/testReporter';
import type { FullConfigInternal } from '../common/config';
import type { ReporterV2 } from '../reporters/reporterV2';

View File

@ -14,22 +14,25 @@
* limitations under the License.
*/
import path from 'path';
import type { FullConfig, Reporter, TestError } from '../../types/testReporter';
import * as path from 'path';
import { InProcessLoaderHost, OutOfProcessLoaderHost } from './loaderHost';
import { createFileFiltersFromArguments, createFileMatcherFromArguments, createTitleMatcher, errorWithFile, forceRegExp } from '../util';
import { buildProjectsClosure, collectFilesForProject, filterProjects } from './projectUtils';
import { createTestGroups, filterForShard } from './testGroups';
import { applyRepeatEachIndex, bindFileSuiteToProject, filterByFocusedLine, filterByTestIds, filterOnly, filterTestsRemoveEmptySuites } from '../common/suiteUtils';
import { Suite } from '../common/test';
import type { TestCase } from '../common/test';
import { dependenciesForTestFile } from '../transform/compilationCache';
import { requireOrImport } from '../transform/transform';
import { sourceMapSupport } from '../utilsBundle';
import type { TestRun } from './tasks';
import type { TestGroup } from './testGroups';
import type { FullConfig, Reporter, TestError } from '../../types/testReporter';
import type { FullProjectInternal } from '../common/config';
import type { FullConfigInternal } from '../common/config';
import { createFileMatcherFromArguments, createFileFiltersFromArguments, createTitleMatcher, errorWithFile, forceRegExp } from '../util';
import type { TestCase } from '../common/test';
import type { Matcher, TestFileFilter } from '../util';
import { buildProjectsClosure, collectFilesForProject, filterProjects } from './projectUtils';
import type { TestRun } from './tasks';
import { requireOrImport } from '../transform/transform';
import { applyRepeatEachIndex, bindFileSuiteToProject, filterByFocusedLine, filterByTestIds, filterOnly, filterTestsRemoveEmptySuites } from '../common/suiteUtils';
import { createTestGroups, filterForShard, type TestGroup } from './testGroups';
import { dependenciesForTestFile } from '../transform/compilationCache';
import { sourceMapSupport } from '../utilsBundle';
import type { RawSourceMap } from '../utilsBundle';

View File

@ -14,15 +14,17 @@
* limitations under the License.
*/
import type { TestError } from '../../types/testReporter';
import { serializeConfig } from '../common/ipc';
import { ProcessHost } from './processHost';
import { incorporateCompilationCache } from '../common/esmLoaderHost';
import { serializeConfig } from '../common/ipc';
import { PoolBuilder } from '../common/poolBuilder';
import { Suite } from '../common/test';
import { loadTestFile } from '../common/testLoader';
import type { FullConfigInternal } from '../common/config';
import { PoolBuilder } from '../common/poolBuilder';
import { addToCompilationCache } from '../transform/compilationCache';
import { incorporateCompilationCache } from '../common/esmLoaderHost';
import type { TestError } from '../../types/testReporter';
import type { FullConfigInternal } from '../common/config';
export class InProcessLoaderHost {
private _config: FullConfigInternal;

View File

@ -16,12 +16,15 @@
import child_process from 'child_process';
import { EventEmitter } from 'events';
import { assert } from 'playwright-core/lib/utils';
import { debug } from 'playwright-core/lib/utilsBundle';
import { esmLoaderRegistered } from '../common/esmLoaderHost';
import { execArgvWithExperimentalLoaderOptions } from '../transform/esmUtils';
import type { EnvProducedPayload, ProcessInitParams } from '../common/ipc';
import type { ProtocolResponse } from '../common/process';
import { execArgvWithExperimentalLoaderOptions } from '../transform/esmUtils';
import { assert } from 'playwright-core/lib/utils';
import { esmLoaderRegistered } from '../common/esmLoaderHost';
export type ProcessExitData = {
unexpectedly: boolean;

View File

@ -14,14 +14,18 @@
* limitations under the License.
*/
import fs from 'fs';
import path from 'path';
import * as fs from 'fs';
import * as path from 'path';
import { promisify } from 'util';
import { escapeRegExp } from 'playwright-core/lib/utils';
import { minimatch } from 'playwright-core/lib/utilsBundle';
import { promisify } from 'util';
import type { FullProjectInternal } from '../common/config';
import { createFileMatcher } from '../util';
import type { FullProjectInternal } from '../common/config';
const readFileAsync = promisify(fs.readFile);
const readDirAsync = promisify(fs.readdir);

View File

@ -14,15 +14,19 @@
* limitations under the License.
*/
import path from 'path';
import fs from 'fs';
import type { T } from '../transform/babelBundle';
import { types, traverse, babelParse } from '../transform/babelBundle';
import * as fs from 'fs';
import * as path from 'path';
import { MultiMap } from 'playwright-core/lib/utils';
import { colors, diff } from 'playwright-core/lib/utilsBundle';
import type { FullConfigInternal } from '../common/config';
import { filterProjects } from './projectUtils';
import { babelParse, traverse, types } from '../transform/babelBundle';
import type { FullConfigInternal } from '../common/config';
import type { InternalReporter } from '../reporters/internalReporter';
import type { T } from '../transform/babelBundle';
const t: typeof T = types;
type Location = {

View File

@ -14,10 +14,13 @@
* limitations under the License.
*/
import path from 'path';
import type { FullConfig, TestError } from '../../types/testReporter';
import * as path from 'path';
import { calculateSha1 } from 'playwright-core/lib/utils';
import { loadReporter } from './loadUtils';
import { formatError, terminalScreen } from '../reporters/base';
import type { Screen } from '../reporters/base';
import { BlobReporter } from '../reporters/blob';
import DotReporter from '../reporters/dot';
import EmptyReporter from '../reporters/empty';
import GitHubReporter from '../reporters/github';
@ -26,13 +29,15 @@ import JSONReporter from '../reporters/json';
import JUnitReporter from '../reporters/junit';
import LineReporter from '../reporters/line';
import ListReporter from '../reporters/list';
import type { Suite } from '../common/test';
import type { BuiltInReporter, FullConfigInternal } from '../common/config';
import { loadReporter } from './loadUtils';
import { BlobReporter } from '../reporters/blob';
import { wrapReporterAsV2 } from '../reporters/reporterV2';
import type { ReporterDescription } from '../../types/test';
import { type ReporterV2, wrapReporterAsV2 } from '../reporters/reporterV2';
import { calculateSha1 } from 'playwright-core/lib/utils';
import type { FullConfig, TestError } from '../../types/testReporter';
import type { BuiltInReporter, FullConfigInternal } from '../common/config';
import type { Suite } from '../common/test';
import type { Screen } from '../reporters/base';
import type { ReporterV2 } from '../reporters/reporterV2';
export async function createReporters(config: FullConfigInternal, mode: 'list' | 'test' | 'merge', isTestServer: boolean, descriptions?: ReporterDescription[]): Promise<ReporterV2[]> {
const defaultReporters: { [key in BuiltInReporter]: new(arg: any) => ReporterV2 } = {

View File

@ -15,17 +15,19 @@
* limitations under the License.
*/
import type { FullResult, TestError } from '../../types/testReporter';
import { webServerPluginsForConfig } from '../plugins/webServerPlugin';
import { addGitCommitInfoPlugin } from '../plugins/gitCommitInfoPlugin';
import { LastRunReporter } from './lastRun';
import { collectFilesForProject, filterProjects } from './projectUtils';
import { createErrorCollectingReporter, createReporters } from './reporters';
import { TestRun, createApplyRebaselinesTask, createClearCacheTask, createGlobalSetupTasks, createLoadTask, createPluginSetupTasks, createReportBeginTask, createRunTestsTasks, createStartDevServerTask, runTasks } from './tasks';
import type { FullConfigInternal } from '../common/config';
import { affectedTestFiles } from '../transform/compilationCache';
import { InternalReporter } from '../reporters/internalReporter';
import { LastRunReporter } from './lastRun';
import { addGitCommitInfoPlugin } from '../plugins/gitCommitInfoPlugin';
import { webServerPluginsForConfig } from '../plugins/webServerPlugin';
import { terminalScreen } from '../reporters/base';
import { InternalReporter } from '../reporters/internalReporter';
import { affectedTestFiles } from '../transform/compilationCache';
import type { FullResult, TestError } from '../../types/testReporter';
import type { FullConfigInternal } from '../common/config';
type ProjectConfigWithFiles = {
name: string;

View File

@ -14,11 +14,14 @@
* limitations under the License.
*/
import { colors, debug } from 'playwright-core/lib/utilsBundle';
import { ManualPromise, monotonicTime } from 'playwright-core/lib/utils';
import type { FullResult, TestError } from '../../types/testReporter';
import { colors, debug } from 'playwright-core/lib/utilsBundle';
import { SigIntWatcher } from './sigIntWatcher';
import { serializeError } from '../util';
import type { FullResult, TestError } from '../../types/testReporter';
import type { InternalReporter } from '../reporters/internalReporter';
type TaskPhase<Context> = (context: Context, errors: TestError[], softErrors: TestError[]) => Promise<void> | void;

View File

@ -14,27 +14,34 @@
* limitations under the License.
*/
import fs from 'fs';
import path from 'path';
import * as fs from 'fs';
import * as path from 'path';
import { promisify } from 'util';
import { monotonicTime, removeFolders } from 'playwright-core/lib/utils';
import { debug } from 'playwright-core/lib/utilsBundle';
import { type ManualPromise, monotonicTime, removeFolders } from 'playwright-core/lib/utils';
import { Dispatcher, type EnvByProjectId } from './dispatcher';
import type { TestRunnerPluginRegistration } from '../plugins';
import { createTestGroups, type TestGroup } from '../runner/testGroups';
import type { Task } from './taskRunner';
import { TaskRunner } from './taskRunner';
import type { FullConfigInternal, FullProjectInternal } from '../common/config';
import { collectProjectsAndTestFiles, createRootSuite, loadFileSuites, loadGlobalHook } from './loadUtils';
import { removeDirAndLogToConsole, type Matcher } from '../util';
import { Suite } from '../common/test';
import { buildDependentProjects, buildTeardownToSetupsMap, filterProjects } from './projectUtils';
import { Dispatcher } from './dispatcher';
import { FailureTracker } from './failureTracker';
import { detectChangedTestFiles } from './vcs';
import type { InternalReporter } from '../reporters/internalReporter';
import { cacheDir } from '../transform/compilationCache';
import type { FullResult } from '../../types/testReporter';
import { collectProjectsAndTestFiles, createRootSuite, loadFileSuites, loadGlobalHook } from './loadUtils';
import { buildDependentProjects, buildTeardownToSetupsMap, filterProjects } from './projectUtils';
import { applySuggestedRebaselines, clearSuggestedRebaselines } from './rebase';
import { Suite } from '../common/test';
import { createTestGroups } from '../runner/testGroups';
import { removeDirAndLogToConsole } from '../util';
import { TaskRunner } from './taskRunner';
import { detectChangedTestFiles } from './vcs';
import { cacheDir } from '../transform/compilationCache';
import type { TestGroup } from '../runner/testGroups';
import type { Matcher } from '../util';
import type { EnvByProjectId } from './dispatcher';
import type { TestRunnerPluginRegistration } from '../plugins';
import type { Task } from './taskRunner';
import type { FullResult } from '../../types/testReporter';
import type { FullConfigInternal, FullProjectInternal } from '../common/config';
import type { InternalReporter } from '../reporters/internalReporter';
import type { ManualPromise } from 'playwright-core/lib/utils';
const readDirAsync = promisify(fs.readdir);

View File

@ -14,32 +14,35 @@
* limitations under the License.
*/
import fs from 'fs';
import path from 'path';
import * as fs from 'fs';
import * as path from 'path';
import { installRootRedirect, openTraceInBrowser, openTraceViewerApp, registry, startTraceViewerServer } from 'playwright-core/lib/server';
import { ManualPromise, gracefullyProcessExitDoNotHang, isUnderTest } from 'playwright-core/lib/utils';
import type { Transport, HttpServer } from 'playwright-core/lib/utils';
import type * as reporterTypes from '../../types/testReporter';
import { affectedTestFiles, collectAffectedTestFiles, dependenciesForTestFile } from '../transform/compilationCache';
import type { ConfigLocation, FullConfigInternal } from '../common/config';
import { createErrorCollectingReporter, createReporterForTestServer, createReporters } from './reporters';
import { TestRun, runTasks, createLoadTask, createRunTestsTasks, createReportBeginTask, createListFilesTask, runTasksDeferCleanup, createClearCacheTask, createGlobalSetupTasks, createStartDevServerTask, createApplyRebaselinesTask } from './tasks';
import { open } from 'playwright-core/lib/utilsBundle';
import ListReporter from '../reporters/list';
import { createErrorCollectingReporter, createReporterForTestServer, createReporters } from './reporters';
import { SigIntWatcher } from './sigIntWatcher';
import { Watcher } from '../fsWatcher';
import type { ReportEntry, TestServerInterface, TestServerInterfaceEventEmitters } from '../isomorphic/testServerInterface';
import type { ConfigCLIOverrides } from '../common/ipc';
import { TestRun, createApplyRebaselinesTask, createClearCacheTask, createGlobalSetupTasks, createListFilesTask, createLoadTask, createReportBeginTask, createRunTestsTasks, createStartDevServerTask, runTasks, runTasksDeferCleanup } from './tasks';
import { loadConfig, resolveConfigLocation, restartWithExperimentalTsEsm } from '../common/configLoader';
import { webServerPluginsForConfig } from '../plugins/webServerPlugin';
import type { TraceViewerRedirectOptions, TraceViewerServerOptions } from 'playwright-core/lib/server/trace/viewer/traceViewer';
import type { TestRunnerPluginRegistration } from '../plugins';
import { serializeError } from '../util';
import { Watcher } from '../fsWatcher';
import { baseFullConfig } from '../isomorphic/teleReceiver';
import { InternalReporter } from '../reporters/internalReporter';
import type { ReporterV2 } from '../reporters/reporterV2';
import { internalScreen } from '../reporters/base';
import { addGitCommitInfoPlugin } from '../plugins/gitCommitInfoPlugin';
import { webServerPluginsForConfig } from '../plugins/webServerPlugin';
import { internalScreen } from '../reporters/base';
import { InternalReporter } from '../reporters/internalReporter';
import ListReporter from '../reporters/list';
import { affectedTestFiles, collectAffectedTestFiles, dependenciesForTestFile } from '../transform/compilationCache';
import { serializeError } from '../util';
import type * as reporterTypes from '../../types/testReporter';
import type { ConfigLocation, FullConfigInternal } from '../common/config';
import type { ConfigCLIOverrides } from '../common/ipc';
import type { ReportEntry, TestServerInterface, TestServerInterfaceEventEmitters } from '../isomorphic/testServerInterface';
import type { TestRunnerPluginRegistration } from '../plugins';
import type { ReporterV2 } from '../reporters/reporterV2';
import type { TraceViewerRedirectOptions, TraceViewerServerOptions } from 'playwright-core/lib/server/trace/viewer/traceViewer';
import type { HttpServer, Transport } from 'playwright-core/lib/utils';
const originalStdoutWrite = process.stdout.write;
const originalStderrWrite = process.stderr.write;

View File

@ -15,8 +15,9 @@
*/
import childProcess from 'child_process';
import * as path from 'path';
import { affectedTestFiles } from '../transform/compilationCache';
import path from 'path';
export async function detectChangedTestFiles(baseCommit: string, configDir: string): Promise<Set<string>> {
function gitFileList(command: string) {

View File

@ -14,20 +14,25 @@
* limitations under the License.
*/
import * as path from 'path';
import readline from 'readline';
import path from 'path';
import { createGuid, eventsHelper, getPackageManagerExecCommand, ManualPromise } from 'playwright-core/lib/utils';
import type { ConfigLocation } from '../common/config';
import type { FullResult } from '../../types/testReporter';
import { colors } from 'playwright-core/lib/utilsBundle';
import { enquirer } from '../utilsBundle';
import { separator, terminalScreen } from '../reporters/base';
import { PlaywrightServer } from 'playwright-core/lib/remote/playwrightServer';
import { TestServerDispatcher } from './testServer';
import { EventEmitter } from 'stream';
import { type TestServerTransport, TestServerConnection } from '../isomorphic/testServerConnection';
import { TeleSuiteUpdater } from '../isomorphic/teleSuiteUpdater';
import { PlaywrightServer } from 'playwright-core/lib/remote/playwrightServer';
import { ManualPromise, createGuid, eventsHelper, getPackageManagerExecCommand } from 'playwright-core/lib/utils';
import { colors } from 'playwright-core/lib/utilsBundle';
import { separator, terminalScreen } from '../reporters/base';
import { enquirer } from '../utilsBundle';
import { TestServerDispatcher } from './testServer';
import { restartWithExperimentalTsEsm } from '../common/configLoader';
import { TeleSuiteUpdater } from '../isomorphic/teleSuiteUpdater';
import { TestServerConnection } from '../isomorphic/testServerConnection';
import type { FullResult } from '../../types/testReporter';
import type { ConfigLocation } from '../common/config';
import type { TestServerTransport } from '../isomorphic/testServerConnection';
class InMemoryTransport extends EventEmitter implements TestServerTransport {
public readonly _send: (data: string) => void;

View File

@ -14,15 +14,19 @@
* limitations under the License.
*/
import fs from 'fs';
import path from 'path';
import type { TestGroup } from './testGroups';
import { stdioChunkToParams } from '../common/ipc';
import type { RunPayload, SerializedConfig, WorkerInitParams } from '../common/ipc';
import { ProcessHost } from './processHost';
import { artifactsFolderName } from '../isomorphic/folders';
import * as fs from 'fs';
import * as path from 'path';
import { removeFolders } from 'playwright-core/lib/utils';
import { ProcessHost } from './processHost';
import { stdioChunkToParams } from '../common/ipc';
import { artifactsFolderName } from '../isomorphic/folders';
import type { TestGroup } from './testGroups';
import type { RunPayload, SerializedConfig, WorkerInitParams } from '../common/ipc';
let lastWorkerIndex = 0;
export class WorkerHost extends ProcessHost {

View File

@ -24,5 +24,5 @@ export type BabelTransformFunction = (code: string, filename: string, isModule:
export const babelTransform: BabelTransformFunction = require('./babelBundleImpl').babelTransform;
export type BabelParseFunction = (code: string, filename: string, isModule: boolean) => ParseResult;
export const babelParse: BabelParseFunction = require('./babelBundleImpl').babelParse;
export type { NodePath, types as T, PluginObj } from '../../bundles/babel/node_modules/@types/babel__core';
export type { NodePath, PluginObj, types as T } from '../../bundles/babel/node_modules/@types/babel__core';
export type { BabelAPI } from '../../bundles/babel/node_modules/@types/babel__helper-plugin-utils';

View File

@ -14,11 +14,12 @@
* limitations under the License.
*/
import fs from 'fs';
import os from 'os';
import path from 'path';
import { sourceMapSupport } from '../utilsBundle';
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import { isWorkerProcess } from '../common/globals';
import { sourceMapSupport } from '../utilsBundle';
export type MemoryCache = {
codePath: string;

View File

@ -14,11 +14,12 @@
* limitations under the License.
*/
import fs from 'fs';
import url from 'url';
import * as fs from 'fs';
import * as url from 'url';
import { addToCompilationCache, currentFileDepsCollector, serializeCompilationCache, startCollectingFileDeps, stopCollectingFileDeps } from './compilationCache';
import { transformHook, resolveHook, setTransformConfig, shouldTransform, setSingleTSConfig } from './transform';
import { PortTransport } from './portTransport';
import { resolveHook, setSingleTSConfig, setTransformConfig, shouldTransform, transformHook } from './transform';
import { fileIsModule } from '../util';
// Node < 18.6: defaultResolve takes 3 arguments.
@ -120,4 +121,4 @@ function createTransport(port: MessagePort) {
}
module.exports = { resolve, load, globalPreload, initialize };
module.exports = { globalPreload, initialize, load, resolve };

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import url from 'url';
import * as url from 'url';
const kExperimentalLoaderOptions = [
'--no-warnings',

View File

@ -15,18 +15,21 @@
*/
import crypto from 'crypto';
import fs from 'fs';
import path from 'path';
import url from 'url';
import { sourceMapSupport, pirates } from '../utilsBundle';
import * as fs from 'fs';
import Module from 'module';
import * as path from 'path';
import * as url from 'url';
import { loadTsConfig } from '../third_party/tsconfig-loader';
import { createFileMatcher, fileIsModule, resolveImportSpecifierAfterMapping } from '../util';
import { pirates, sourceMapSupport } from '../utilsBundle';
import { belongsToNodeModules, currentFileDepsCollector, getFromCompilationCache, installSourceMapSupport } from './compilationCache';
import type { BabelPlugin, BabelTransformFunction } from './babelBundle';
import type { Location } from '../../types/testReporter';
import type { LoadedTsConfig } from '../third_party/tsconfig-loader';
import { loadTsConfig } from '../third_party/tsconfig-loader';
import Module from 'module';
import type { BabelPlugin, BabelTransformFunction } from './babelBundle';
import { createFileMatcher, fileIsModule, resolveImportSpecifierAfterMapping } from '../util';
import type { Matcher } from '../util';
import { getFromCompilationCache, currentFileDepsCollector, belongsToNodeModules, installSourceMapSupport } from './compilationCache';
const version = require('../../package.json').version;

Some files were not shown because too many files have changed in this diff Show More