From 2fa3a0913701cf07ad506ad47fc720b79a39e9f4 Mon Sep 17 00:00:00 2001 From: Shakker Date: Fri, 3 Apr 2026 12:45:57 +0100 Subject: [PATCH] test: harden command queue timer cleanup --- src/process/command-queue.test.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/process/command-queue.test.ts b/src/process/command-queue.test.ts index 119d8303ee9..3dc017d068c 100644 --- a/src/process/command-queue.test.ts +++ b/src/process/command-queue.test.ts @@ -1,4 +1,4 @@ -import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { importFreshModule } from "../../test/helpers/import-fresh.js"; import { CommandLane } from "./lanes.js"; @@ -74,6 +74,7 @@ describe("command queue", () => { }); beforeEach(() => { + vi.useRealTimers(); resetCommandQueueStateForTest(); // Queue state is global across module instances, so reset main lane // concurrency explicitly to avoid cross-file leakage. @@ -85,6 +86,10 @@ describe("command queue", () => { diagnosticMocks.diag.error.mockClear(); }); + afterEach(() => { + vi.useRealTimers(); + }); + it("resetAllLanes is safe when no lanes have been created", () => { expect(getActiveTaskCount()).toBe(0); expect(() => resetAllLanes()).not.toThrow();