mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-22 14:41:34 +00:00
test: harden shared-worker runtime setup
This commit is contained in:
@@ -10,15 +10,27 @@ const fsMocks = vi.hoisted(() => ({
|
||||
realpath: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("node:fs/promises", () => ({
|
||||
default: { access: fsMocks.access, realpath: fsMocks.realpath },
|
||||
access: fsMocks.access,
|
||||
realpath: fsMocks.realpath,
|
||||
}));
|
||||
vi.mock("node:fs/promises", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("node:fs/promises")>();
|
||||
return {
|
||||
...actual,
|
||||
default: {
|
||||
...actual,
|
||||
access: fsMocks.access,
|
||||
realpath: fsMocks.realpath,
|
||||
},
|
||||
access: fsMocks.access,
|
||||
realpath: fsMocks.realpath,
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock("node:child_process", () => ({
|
||||
execFileSync: childProcessMocks.execFileSync,
|
||||
}));
|
||||
vi.mock("node:child_process", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("node:child_process")>();
|
||||
return {
|
||||
...actual,
|
||||
execFileSync: childProcessMocks.execFileSync,
|
||||
};
|
||||
});
|
||||
|
||||
import { resolveGatewayProgramArguments } from "./program-args.js";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user