mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 06:10:22 +00:00
fix: stabilize full gate
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { ChildProcess } from "node:child_process";
|
||||
import { EventEmitter } from "node:events";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const spawnMock = vi.hoisted(() => vi.fn());
|
||||
|
||||
@@ -12,7 +12,9 @@ vi.mock("node:child_process", async () => {
|
||||
};
|
||||
});
|
||||
|
||||
import { runCommandWithTimeout } from "./exec.js";
|
||||
type ExecModule = typeof import("./exec.js");
|
||||
|
||||
let runCommandWithTimeout: ExecModule["runCommandWithTimeout"];
|
||||
|
||||
function createFakeSpawnedChild() {
|
||||
const child = new EventEmitter() as EventEmitter & ChildProcess;
|
||||
@@ -39,6 +41,11 @@ function createFakeSpawnedChild() {
|
||||
}
|
||||
|
||||
describe("runCommandWithTimeout no-output timer", () => {
|
||||
beforeEach(async () => {
|
||||
vi.resetModules();
|
||||
({ runCommandWithTimeout } = await import("./exec.js"));
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
vi.restoreAllMocks();
|
||||
|
||||
Reference in New Issue
Block a user