From 140392e35592ca00f5e202c4484ca5528232b6ff Mon Sep 17 00:00:00 2001 From: Adam Gastineau Date: Wed, 5 Feb 2025 06:02:35 -0800 Subject: [PATCH] Address PR comments --- packages/playwright/src/worker/workerMain.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/playwright/src/worker/workerMain.ts b/packages/playwright/src/worker/workerMain.ts index eea043721f..8bd7f3dcd0 100644 --- a/packages/playwright/src/worker/workerMain.ts +++ b/packages/playwright/src/worker/workerMain.ts @@ -50,8 +50,6 @@ export class WorkerMain extends ProcessRunner { private _didRunFullCleanup = false; // Whether the worker was requested to stop. private _isStopped = false; - // Whether a fatal error was caused by a missing project. - private _isMissingProject = false; // This promise resolves once the single "run test group" call finishes. private _runFinished = new ManualPromise(); private _currentTest: TestInfoImpl | null = null; @@ -107,7 +105,7 @@ export class WorkerMain extends ProcessRunner { override async gracefullyClose() { try { await this._stop(); - if (this._isMissingProject) { + if (!this._config) { // We never set anything up and we can crash on attempting cleanup return; } @@ -196,12 +194,11 @@ export class WorkerMain extends ProcessRunner { if (this._config) return; - this._config = await deserializeConfig(this._params.config); - const project = this._config.projects.find(p => p.id === this._params.projectId); - if (!project) { - this._isMissingProject = true; - throw new Error(`Project with name "${this._params.projectId}" not found. Make sure project name does not change`); - } + const config = await deserializeConfig(this._params.config); + const project = config.projects.find(p => p.id === this._params.projectId); + if (!project) + throw new Error(`Project "${this._params.projectId}" not found in the worker process. Make sure project name does not change.`); + this._config = config; this._project = project; this._poolBuilder = PoolBuilder.createForWorker(this._project); }