Address PR comments

This commit is contained in:
Adam Gastineau 2025-02-05 06:02:35 -08:00
parent d35371bf06
commit 140392e355

View file

@ -50,8 +50,6 @@ export class WorkerMain extends ProcessRunner {
private _didRunFullCleanup = false; private _didRunFullCleanup = false;
// Whether the worker was requested to stop. // Whether the worker was requested to stop.
private _isStopped = false; 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. // This promise resolves once the single "run test group" call finishes.
private _runFinished = new ManualPromise<void>(); private _runFinished = new ManualPromise<void>();
private _currentTest: TestInfoImpl | null = null; private _currentTest: TestInfoImpl | null = null;
@ -107,7 +105,7 @@ export class WorkerMain extends ProcessRunner {
override async gracefullyClose() { override async gracefullyClose() {
try { try {
await this._stop(); await this._stop();
if (this._isMissingProject) { if (!this._config) {
// We never set anything up and we can crash on attempting cleanup // We never set anything up and we can crash on attempting cleanup
return; return;
} }
@ -196,12 +194,11 @@ export class WorkerMain extends ProcessRunner {
if (this._config) if (this._config)
return; return;
this._config = await deserializeConfig(this._params.config); const config = await deserializeConfig(this._params.config);
const project = this._config.projects.find(p => p.id === this._params.projectId); const project = config.projects.find(p => p.id === this._params.projectId);
if (!project) { if (!project)
this._isMissingProject = true; throw new Error(`Project "${this._params.projectId}" not found in the worker process. Make sure project name does not change.`);
throw new Error(`Project with name "${this._params.projectId}" not found. Make sure project name does not change`); this._config = config;
}
this._project = project; this._project = project;
this._poolBuilder = PoolBuilder.createForWorker(this._project); this._poolBuilder = PoolBuilder.createForWorker(this._project);
} }