diff --git a/src/resources/extensions/sf/tests/parallel-orchestrator-zombie-cleanup.test.ts b/src/resources/extensions/sf/tests/parallel-orchestrator-zombie-cleanup.test.ts index 8bb196319..263d77800 100644 --- a/src/resources/extensions/sf/tests/parallel-orchestrator-zombie-cleanup.test.ts +++ b/src/resources/extensions/sf/tests/parallel-orchestrator-zombie-cleanup.test.ts @@ -13,7 +13,7 @@ import { randomUUID } from "node:crypto"; import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { test, afterEach } from 'vitest'; +import { test, afterEach, beforeEach } from 'vitest'; import { getOrchestratorState, @@ -73,14 +73,16 @@ function writeSessionStatusFile( // killable by this process, but 2147483647 is unlikely to exist. const _DEAD_PID = 2147483647; +// Reset module-level orchestrator state before every test so the shared +// `state` singleton in parallel-orchestrator.ts can't leak across tests. +beforeEach(() => { + resetOrchestrator(); +}); + // ─── refreshWorkerStatuses: deactivates when all workers dead ────────── test("#2736: refreshWorkerStatuses deactivates orchestrator when all workers are error/stopped", (t) => { const base = makeTmpBase(); - afterEach(() => { - resetOrchestrator(); - cleanup(base); - }); // Seed persisted state with two workers using current PID (alive) so // restoreState() accepts them, then immediately mark them as error via