mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 07:20:23 +00:00
test: harden shared-worker runtime setup
This commit is contained in:
@@ -1,15 +1,24 @@
|
||||
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
vi.mock("node:child_process", () => ({
|
||||
execFileSync: vi.fn(),
|
||||
}));
|
||||
vi.mock("node:fs", () => {
|
||||
vi.mock("node:child_process", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("node:child_process")>();
|
||||
return {
|
||||
...actual,
|
||||
execFileSync: vi.fn(),
|
||||
};
|
||||
});
|
||||
vi.mock("node:fs", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("node:fs")>();
|
||||
const existsSync = vi.fn();
|
||||
const readFileSync = vi.fn();
|
||||
const module = { existsSync, readFileSync };
|
||||
return {
|
||||
...actual,
|
||||
...module,
|
||||
default: module,
|
||||
default: {
|
||||
...actual,
|
||||
...module,
|
||||
},
|
||||
};
|
||||
});
|
||||
vi.mock("node:os", () => {
|
||||
|
||||
Reference in New Issue
Block a user