From 1aebad3ffe36863f1d8a26cdc0b7c92426167400 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Fri, 21 Feb 2025 19:47:00 -0500 Subject: [PATCH] type fixes (#2) --- docs/src/test-api/class-fullconfig.md | 4 ++++ docs/src/test-api/class-testconfig.md | 3 +++ packages/playwright/src/common/config.ts | 4 +--- packages/playwright/src/worker/workerMain.ts | 2 +- packages/playwright/types/test.d.ts | 2 ++ 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/src/test-api/class-fullconfig.md b/docs/src/test-api/class-fullconfig.md index 923c9fa858..5af11cf24f 100644 --- a/docs/src/test-api/class-fullconfig.md +++ b/docs/src/test-api/class-fullconfig.md @@ -109,6 +109,10 @@ Base directory for all relative paths used in the reporters. - type: <[null]|[Object]> - `total` <[int]> The total number of shards. - `current` <[int]> The index of the shard to execute, one-based. + +## property: FullConfig.skipAfterAnyFailure +* since: v1.51 +- type: <[boolean]> See [`property: TestConfig.shard`]. diff --git a/docs/src/test-api/class-testconfig.md b/docs/src/test-api/class-testconfig.md index 0acafa16c5..04a7dca6db 100644 --- a/docs/src/test-api/class-testconfig.md +++ b/docs/src/test-api/class-testconfig.md @@ -506,6 +506,9 @@ export default defineConfig({ }); ``` +## property: TestConfig.skipAfterAnyFailure? +* since: v1.51 +- type: <[boolean]> ## property: TestConfig.testDir * since: v1.10 diff --git a/packages/playwright/src/common/config.ts b/packages/playwright/src/common/config.ts index e443f86a29..bcb8442e03 100644 --- a/packages/playwright/src/common/config.ts +++ b/packages/playwright/src/common/config.ts @@ -49,7 +49,6 @@ export class FullConfigInternal { readonly projects: FullProjectInternal[] = []; readonly singleTSConfigPath?: string; readonly populateGitInfo: boolean; - readonly skipAfterAnyFailure: boolean; cliArgs: string[] = []; cliGrep: string | undefined; cliGrepInvert: string | undefined; @@ -88,8 +87,6 @@ export class FullConfigInternal { // so that plugins such as gitCommitInfoPlugin can populate metadata once. userConfig.metadata = userConfig.metadata || {}; - this.skipAfterAnyFailure = userConfig.skipAfterAnyFailure ?? true; - this.config = { configFile: resolvedConfigFile, rootDir: pathResolve(configDir, userConfig.testDir) || configDir, @@ -108,6 +105,7 @@ export class FullConfigInternal { quiet: takeFirst(configCLIOverrides.quiet, userConfig.quiet, false), projects: [], shard: takeFirst(configCLIOverrides.shard, userConfig.shard, null), + skipAfterAnyFailure: userConfig.skipAfterAnyFailure ?? true, updateSnapshots: takeFirst(configCLIOverrides.updateSnapshots, userConfig.updateSnapshots, 'missing'), updateSourceMethod: takeFirst(configCLIOverrides.updateSourceMethod, userConfig.updateSourceMethod, 'patch'), version: require('../../package.json').version, diff --git a/packages/playwright/src/worker/workerMain.ts b/packages/playwright/src/worker/workerMain.ts index 140a39a20d..7c89ac8526 100644 --- a/packages/playwright/src/worker/workerMain.ts +++ b/packages/playwright/src/worker/workerMain.ts @@ -394,7 +394,7 @@ export class WorkerMain extends ProcessRunner { const afterHooksTimeout = calculateMaxTimeout(this._project.project.timeout, testInfo.timeout); const afterHooksSlot = { timeout: afterHooksTimeout, elapsed: 0 }; - const FAILURE_AND_SkIP_NOW = testInfo._isFailure() && this._config.skipAfterAnyFailure; + const FAILURE_AND_SkIP_NOW = testInfo._isFailure() && this._config.config.skipAfterAnyFailure; await testInfo._runAsStage({ title: 'After Hooks', stepInfo: { category: 'hook' } }, async () => { let firstAfterHooksError: Error | undefined; diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index 14f2f75f02..8de3cc17a5 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -1949,6 +1949,8 @@ export interface FullConfig { current: number; }; + skipAfterAnyFailure: boolean; + /** * See [testConfig.updateSnapshots](https://playwright.dev/docs/api/class-testconfig#test-config-update-snapshots). */