From d9da8c2cc0ea6f31f250ea0cd30ec259e6d232cd Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Sat, 22 Feb 2025 08:24:59 -0500 Subject: [PATCH] Recreate worker (#4) --- docs/src/test-api/class-testconfig.md | 2 +- packages/playwright/src/common/config.ts | 4 ++-- packages/playwright/src/worker/workerMain.ts | 2 +- packages/playwright/types/test.d.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/src/test-api/class-testconfig.md b/docs/src/test-api/class-testconfig.md index 04a7dca6db..e7e3c9e21b 100644 --- a/docs/src/test-api/class-testconfig.md +++ b/docs/src/test-api/class-testconfig.md @@ -506,7 +506,7 @@ export default defineConfig({ }); ``` -## property: TestConfig.skipAfterAnyFailure? +## property: TestConfig.recreateWorkerAfterFailure? * since: v1.51 - type: <[boolean]> diff --git a/packages/playwright/src/common/config.ts b/packages/playwright/src/common/config.ts index e443f86a29..3ee2ec12ea 100644 --- a/packages/playwright/src/common/config.ts +++ b/packages/playwright/src/common/config.ts @@ -49,7 +49,7 @@ export class FullConfigInternal { readonly projects: FullProjectInternal[] = []; readonly singleTSConfigPath?: string; readonly populateGitInfo: boolean; - readonly skipAfterAnyFailure: boolean; + readonly recreateWorkerAfterFailure: boolean; cliArgs: string[] = []; cliGrep: string | undefined; cliGrepInvert: string | undefined; @@ -88,7 +88,7 @@ export class FullConfigInternal { // so that plugins such as gitCommitInfoPlugin can populate metadata once. userConfig.metadata = userConfig.metadata || {}; - this.skipAfterAnyFailure = userConfig.skipAfterAnyFailure ?? true; + this.recreateWorkerAfterFailure = userConfig.recreateWorkerAfterFailure ?? true; this.config = { configFile: resolvedConfigFile, diff --git a/packages/playwright/src/worker/workerMain.ts b/packages/playwright/src/worker/workerMain.ts index 140a39a20d..5d7e3a31f6 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.recreateWorkerAfterFailure; 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..c4b4f57069 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -1525,7 +1525,7 @@ interface TestConfig { total: number; }; - skipAfterAnyFailure?: boolean; + recreateWorkerAfterFailure?: boolean; /** * **NOTE** Use