diff --git a/packages/playwright/src/common/config.ts b/packages/playwright/src/common/config.ts index 3237b71284..ab5e6ca805 100644 --- a/packages/playwright/src/common/config.ts +++ b/packages/playwright/src/common/config.ts @@ -17,13 +17,13 @@ import fs from 'fs'; import path from 'path'; import os from 'os'; -import type { Config, Fixtures, Project, ReporterDescription } from '../../types/test'; +import type { Config, ConfigInWorker, Fixtures, Project, ReporterDescription } from '../../types/test'; import type { Location } from '../../types/testReporter'; import type { TestRunnerPluginRegistration } from '../plugins'; import { getPackageJsonPath, mergeObjects } from '../util'; import type { Matcher } from '../util'; import type { ConfigCLIOverrides } from './ipc'; -import type { ConfigInWorker, ProjectInWorker } from '../../types/test'; +import type { FullConfig, FullProject } from '../../types/testReporter'; import { setTransformConfig } from '../transform/transform'; export type ConfigLocation = { @@ -40,13 +40,13 @@ export type Annotation = { type: string, description?: string }; export const defaultTimeout = 30000; export class FullConfigInternal { - readonly config: ConfigInWorker; + readonly config: FullConfig; readonly globalOutputDir: string; readonly configDir: string; readonly configCLIOverrides: ConfigCLIOverrides; readonly ignoreSnapshots: boolean; readonly preserveOutputDir: boolean; - readonly webServers: Exclude[]; + readonly webServers: NonNullable[]; readonly plugins: TestRunnerPluginRegistration[]; readonly projects: FullProjectInternal[] = []; cliArgs: string[] = []; @@ -123,7 +123,7 @@ export class FullConfigInternal { this.config.webServer = null; this.webServers = webServers; } else if (webServers) { // legacy singleton mode - this.config.webServer = webServers; + this.config.webServer = webServers as NonNullable; this.webServers = [webServers]; } else { this.webServers = []; @@ -158,7 +158,7 @@ export class FullConfigInternal { } export class FullProjectInternal { - readonly project: ProjectInWorker; + readonly project: FullProject; readonly fullConfig: FullConfigInternal; readonly fullyParallel: boolean; readonly expect: Project['expect']; @@ -286,6 +286,6 @@ export const defaultReporter = process.env.CI ? 'dot' : 'list'; const configInternalSymbol = Symbol('configInternalSymbol'); -export function getProjectId(project: ProjectInWorker): string { +export function getProjectId(project: FullProject): string { return (project as any).__projectId!; } \ No newline at end of file diff --git a/packages/playwright/types/testReporter.d.ts b/packages/playwright/types/testReporter.d.ts index 7b5b81fa04..df4fff6cda 100644 --- a/packages/playwright/types/testReporter.d.ts +++ b/packages/playwright/types/testReporter.d.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import type { TestStatus, Metadata, PlaywrightTestOptions, PlaywrightWorkerOptions, ReporterDescription } from './test'; +import type { TestStatus, Metadata, PlaywrightTestOptions, PlaywrightWorkerOptions, ReporterDescription, ConfigInWorker } from './test'; export type { TestStatus } from './test'; type UseOptions = Partial & Partial; @@ -101,7 +101,7 @@ export interface FullConfig { /** * See [testConfig.webServer](https://playwright.dev/docs/api/class-testconfig#test-config-web-server). */ - webServer: TestConfigWebServer | null; + webServer: NonNullable|null; /** * Path to the configuration file (if any) used to run the tests. */ diff --git a/utils/generate_types/overrides-testReporter.d.ts b/utils/generate_types/overrides-testReporter.d.ts index 8c6eb0a5e8..40c42d4f34 100644 --- a/utils/generate_types/overrides-testReporter.d.ts +++ b/utils/generate_types/overrides-testReporter.d.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type { TestStatus, Metadata, PlaywrightTestOptions, PlaywrightWorkerOptions, ReporterDescription } from './test'; +import type { TestStatus, Metadata, PlaywrightTestOptions, PlaywrightWorkerOptions, ReporterDescription, ConfigInWorker } from './test'; export type { TestStatus } from './test'; type UseOptions = Partial & Partial; @@ -42,7 +42,7 @@ export interface FullConfig { shard: { total: number, current: number } | null; updateSnapshots: 'all' | 'none' | 'missing'; workers: number; - webServer: TestConfigWebServer | null; + webServer: NonNullable|null; configFile?: string; } // [internal] !!! DO NOT ADD TO THIS !!! See prior note.