chore: move testInfo and timeoutManager to worker/ (#20803)

This commit is contained in:
Dmitry Gozman 2023-02-09 19:22:17 -08:00 committed by GitHub
parent 4469e57695
commit ab4cd83e44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 26 additions and 32 deletions

View file

@ -1,8 +1,9 @@
[*]
../common/
../matchers/
../util.ts
../utilsBundle.ts
[transform.ts]
../third_party/tsconfig-loader.ts
[testType.ts]
../matchers/expect.ts

View file

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

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
import type { Fixtures, TestInfoError, Project } from '../../types/test';
import type { Fixtures, Project } from '../../types/test';
import type { Location } from '../../types/testReporter';
import type { TestRunnerPluginRegistration } from '../plugins';
import type { Matcher } from '../util';
@ -29,16 +29,6 @@ export type FixturesWithLocation = {
};
export type Annotation = { type: string, description?: string };
export interface TestStepInternal {
complete(result: { error?: Error | TestInfoError }): void;
title: string;
category: string;
canHaveChildren: boolean;
forceNoParent: boolean;
location?: Location;
refinedTitle?: string;
}
type ConfigInternal = {
globalOutputDir: string;
configDir: string;

View file

@ -20,7 +20,7 @@ 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 './common/testInfo';
import type { TestInfoImpl } from './worker/testInfo';
import { rootTestType } from './common/testType';
import { type ContextReuseMode } from './common/types';
export { expect } from './matchers/expect';

View file

@ -1,6 +1,3 @@
[*]
../common/
../expect.ts
../globals.ts
../testInfo.ts
../util.ts

View file

@ -20,7 +20,7 @@ import { colors } from 'playwright-core/lib/utilsBundle';
import type { Expect } from '../common/types';
import { expectTypes, callLogText } from '../util';
import { currentTestInfo } from '../common/globals';
import type { TestInfoErrorState } from '../common/testInfo';
import type { TestInfoErrorState } from '../worker/testInfo';
import { toBeTruthy } from './toBeTruthy';
import { toEqual } from './toEqual';
import { toExpectedTextValues, toMatchText } from './toMatchText';

View file

@ -30,7 +30,7 @@ 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 '../common/testInfo';
import type { TestInfoImpl } from '../worker/testInfo';
import type { SyncExpectationResult } from './expect';
type NameOrSegments = string | string[];

View file

@ -1,6 +1,4 @@
[*]
../common/
../babelBundle.ts
../test.ts
../util.ts
../utilsBundle.ts

View file

@ -1,7 +1,6 @@
[*]
../../types.ts
../common/
../matchers/
../reporters/
../third_party/
../plugins/

View file

@ -17,8 +17,8 @@
import { formatLocation, debugTest } from '../util';
import type { Location, WorkerInfo } from '../common/types';
import { ManualPromise } from 'playwright-core/lib/utils';
import type { TestInfoImpl } from '../common/testInfo';
import type { FixtureDescription, TimeoutManager } from '../common/timeoutManager';
import type { TestInfoImpl } from './testInfo';
import type { FixtureDescription, TimeoutManager } from './timeoutManager';
import { fixtureParameterNames, type FixturePool, type FixtureRegistration, type FixtureScope } from '../common/fixtures';
class Fixture {

View file

@ -18,10 +18,10 @@ 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 { StepBeginPayload, StepEndPayload, WorkerInitParams } from './ipc';
import type { TestCase } from './test';
import type { StepBeginPayload, StepEndPayload, WorkerInitParams } from '../common/ipc';
import type { TestCase } from '../common/test';
import { TimeoutManager } from './timeoutManager';
import type { Annotation, FullConfigInternal, FullProjectInternal, TestStepInternal } from './types';
import type { Annotation, FullConfigInternal, FullProjectInternal, Location } from '../common/types';
import { getContainedPath, normalizeAndSaveAttachment, sanitizeForFilePath, serializeError, trimLongString } from '../util';
export type TestInfoErrorState = {
@ -30,6 +30,16 @@ export type TestInfoErrorState = {
hasHardError: boolean,
};
interface TestStepInternal {
complete(result: { error?: Error | TestInfoError }): void;
title: string;
category: string;
canHaveChildren: boolean;
forceNoParent: boolean;
location?: Location;
refinedTitle?: string;
}
export class TestInfoImpl implements TestInfo {
private _onStepBegin: (payload: StepBeginPayload) => void;
private _onStepEnd: (payload: StepEndPayload) => void;

View file

@ -16,7 +16,7 @@
import { colors } from 'playwright-core/lib/utilsBundle';
import { TimeoutRunner, TimeoutRunnerError } from 'playwright-core/lib/utils';
import type { Location, TestInfoError } from './types';
import type { Location, TestInfoError } from '../common/types';
export type TimeSlot = {
timeout: number;

View file

@ -24,9 +24,8 @@ import type { Suite, TestCase } from '../common/test';
import type { Annotation, FullConfigInternal, FullProjectInternal, TestInfoError } from '../common/types';
import { FixtureRunner } from './fixtureRunner';
import { ManualPromise } from 'playwright-core/lib/utils';
import { TestInfoImpl } from '../common/testInfo';
import type { TimeSlot } from '../common/timeoutManager';
import { TimeoutManager } from '../common/timeoutManager';
import { TestInfoImpl } from './testInfo';
import { TimeoutManager, type TimeSlot } from './timeoutManager';
import { ProcessRunner } from '../common/process';
import { loadTestFile } from '../common/testLoader';
import { buildFileSuiteForProject, filterTestsRemoveEmptySuites } from '../common/suiteUtils';