diff --git a/src/process/restart-recovery.test.ts b/src/process/restart-recovery.test.ts deleted file mode 100644 index 5091d7b9928..00000000000 --- a/src/process/restart-recovery.test.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { describe, expect, it, vi } from "vitest"; -import { createRestartIterationHook } from "./restart-recovery.js"; - -describe("restart-recovery", () => { - it("skips recovery on first iteration and runs on subsequent iterations", () => { - const onRestart = vi.fn(); - const onIteration = createRestartIterationHook(onRestart); - - expect(onIteration()).toBe(false); - expect(onRestart).not.toHaveBeenCalled(); - - expect(onIteration()).toBe(true); - expect(onRestart).toHaveBeenCalledTimes(1); - - expect(onIteration()).toBe(true); - expect(onRestart).toHaveBeenCalledTimes(2); - }); -}); diff --git a/src/process/spawn-utils.test.ts b/src/process/spawn-utils.test.ts index cb3e0dc1dc0..b5e134ca623 100644 --- a/src/process/spawn-utils.test.ts +++ b/src/process/spawn-utils.test.ts @@ -2,6 +2,7 @@ import type { ChildProcess } from "node:child_process"; import { EventEmitter } from "node:events"; import { PassThrough } from "node:stream"; import { describe, expect, it, vi } from "vitest"; +import { createRestartIterationHook } from "./restart-recovery.js"; import { spawnWithFallback } from "./spawn-utils.js"; function createStubChild() { @@ -61,3 +62,19 @@ describe("spawnWithFallback", () => { expect(spawnMock).toHaveBeenCalledTimes(1); }); }); + +describe("restart-recovery", () => { + it("skips recovery on first iteration and runs on subsequent iterations", () => { + const onRestart = vi.fn(); + const onIteration = createRestartIterationHook(onRestart); + + expect(onIteration()).toBe(false); + expect(onRestart).not.toHaveBeenCalled(); + + expect(onIteration()).toBe(true); + expect(onRestart).toHaveBeenCalledTimes(1); + + expect(onIteration()).toBe(true); + expect(onRestart).toHaveBeenCalledTimes(2); + }); +});