test: reduce agent test import churn

This commit is contained in:
Peter Steinberger
2026-04-03 04:38:38 +01:00
parent 847faa3d04
commit ffd34f8896
25 changed files with 225 additions and 363 deletions

View File

@@ -1,6 +1,6 @@
import type { ChildProcess } from "node:child_process";
import { EventEmitter } from "node:events";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
const spawnMock = vi.hoisted(() => vi.fn());
@@ -54,9 +54,12 @@ function emitProcessExit(
}
describe("runCommandWithTimeout no-output timer", () => {
beforeEach(async () => {
beforeAll(async () => {
vi.resetModules();
({ runCommandWithTimeout } = await import("./exec.js"));
});
beforeEach(() => {
spawnMock.mockClear();
});