Skip to content

Commit 519e384

Browse files
committed
test(engine): isolate peer abort regression
1 parent 23fae65 commit 519e384

1 file changed

Lines changed: 23 additions & 22 deletions

File tree

packages/engine/src/services/parallelCoordinator-peerAbort.test.ts

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,29 @@ describe("executeParallelCapture peer abort", () => {
1414
const root = mkdtempSync(join(tmpdir(), "hf-peer-abort-"));
1515
const captureFrame = vi.fn().mockResolvedValue(undefined);
1616
const closeCaptureSession = vi.fn().mockResolvedValue(undefined);
17-
vi.doMock("./frameCapture.js", async (importOriginal) => {
18-
const original = await importOriginal<typeof import("./frameCapture.js")>();
19-
return {
20-
...original,
21-
createCaptureSession: vi.fn(async (_url: string, outputDir: string) => {
22-
const workerId = outputDir.endsWith("worker-0") ? 0 : 1;
23-
return {
24-
workerId,
25-
browserConsoleBuffer: workerId === 0 ? ["[Browser:ERROR] bad source"] : [],
26-
} as unknown as CaptureSession & { workerId: number };
27-
}),
28-
initializeSession: vi.fn(async (session: CaptureSession & { workerId: number }) => {
29-
if (session.workerId === 0) {
30-
throw new Error("Composition has zero duration. Runtime ready: true");
31-
}
32-
await Promise.resolve();
33-
}),
34-
captureFrame,
35-
closeCaptureSession,
36-
getCapturePerfSummary: vi.fn(() => ({ frames: 0 })),
37-
};
38-
});
17+
// Keep this regression isolated from frameCapture's very large module graph.
18+
// Importing the real module here made the test exceed Vitest's 5s budget
19+
// only when every workspace suite competed for CPU during the CI matrix.
20+
vi.doMock("./frameCapture.js", () => ({
21+
createCaptureSession: vi.fn(async (_url: string, outputDir: string) => {
22+
const workerId = outputDir.endsWith("worker-0") ? 0 : 1;
23+
return {
24+
workerId,
25+
browserConsoleBuffer: workerId === 0 ? ["[Browser:ERROR] bad source"] : [],
26+
} as unknown as CaptureSession & { workerId: number };
27+
}),
28+
initializeSession: vi.fn(async (session: CaptureSession & { workerId: number }) => {
29+
if (session.workerId === 0) {
30+
throw new Error("Composition has zero duration. Runtime ready: true");
31+
}
32+
await Promise.resolve();
33+
}),
34+
captureFrame,
35+
captureFrameToBuffer: vi.fn(),
36+
captureFrameToBufferPipelined: vi.fn(),
37+
closeCaptureSession,
38+
getCapturePerfSummary: vi.fn(() => ({ frames: 0 })),
39+
}));
3940

4041
try {
4142
const { executeParallelCapture } = await import("./parallelCoordinator.js");

0 commit comments

Comments
 (0)