From a1d512f0c326487afd960f5cc096a1897810b3de Mon Sep 17 00:00:00 2001 From: Siarhei_Kliushnikau Date: Sun, 22 Sep 2024 14:01:47 +0200 Subject: [PATCH] added NONE_ISOLATED for beforeAll,afterAll,beforeEach,afterEach --- packages/playwright/src/worker/workerMain.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/playwright/src/worker/workerMain.ts b/packages/playwright/src/worker/workerMain.ts index 969fb83bbc..c23b90ec64 100644 --- a/packages/playwright/src/worker/workerMain.ts +++ b/packages/playwright/src/worker/workerMain.ts @@ -396,7 +396,7 @@ export class WorkerMain extends ProcessRunner { // In case of failure the worker will be stopped and we have to make sure that afterAll // hooks run before worker fixtures teardown. for (const suite of reversedSuites) { - if (!nextSuites.has(suite) || testInfo._isFailure()) { + if (!nextSuites.has(suite) || (testInfo._isFailure() && !process.env.NOT_ISOLATED)) { try { await this._runAfterAllHooksForSuite(suite, testInfo); } catch (error) { @@ -534,8 +534,11 @@ export class WorkerMain extends ProcessRunner { } } } - if (firstError) + if (firstError) { + if (process.env.NONE_ISOLATED) + this._didRunFullCleanup = true; throw firstError; + } } private async _runAfterAllHooksForSuite(suite: Suite, testInfo: TestInfoImpl) {