fix(FN-4642): harden container backend against child_process mocks

Fusion-Task-Id: FN-4642
Fusion-Task-Lineage: a42a36f8-2d2a-43fe-b7c1-d7cf1ad321c3
This commit is contained in:
Fusion (runfusion.ai)
2026-05-16 00:56:41 -07:00
committed by gsxdsm
parent 6998ac4edd
commit 8955db96e2
2 changed files with 20 additions and 11 deletions

View File

@@ -8,11 +8,15 @@ const { mockExec, mockExecFile } = vi.hoisted(() => ({
mockExecFile: vi.fn(),
}));
vi.mock("node:child_process", () => ({
exec: mockExec,
execFile: mockExecFile,
spawn: vi.fn(),
}));
vi.mock("node:child_process", async (importOriginal) => {
const actual = await importOriginal<typeof import("node:child_process")>();
return {
...actual,
exec: mockExec,
execFile: mockExecFile,
spawn: vi.fn(),
};
});
describe("ContainerSandboxBackend", () => {
beforeEach(() => {