mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 05:12:15 +00:00
fix(ci): stabilize planner executor fallback tests
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { EventEmitter } from "node:events";
|
||||
import { PassThrough } from "node:stream";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { importFreshModule } from "../helpers/import-fresh.js";
|
||||
import { createExecutionArtifacts, executePlan } from "../../scripts/test-planner/executor.mjs";
|
||||
|
||||
beforeEach(() => {
|
||||
vi.spyOn(console, "log").mockImplementation(() => {});
|
||||
@@ -13,7 +13,6 @@ beforeEach(() => {
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
vi.restoreAllMocks();
|
||||
vi.resetModules();
|
||||
});
|
||||
|
||||
describe("test planner executor", () => {
|
||||
@@ -33,13 +32,6 @@ describe("test planner executor", () => {
|
||||
}, 0);
|
||||
return fakeChild;
|
||||
});
|
||||
vi.doMock("node:child_process", () => ({
|
||||
spawn: spawnMock,
|
||||
}));
|
||||
|
||||
const { executePlan, createExecutionArtifacts } = await importFreshModule<
|
||||
typeof import("../../scripts/test-planner/executor.mjs")
|
||||
>(import.meta.url, "../../scripts/test-planner/executor.mjs?scope=exit-fallback");
|
||||
const artifacts = createExecutionArtifacts({ OPENCLAW_TEST_CLOSE_GRACE_MS: "10" });
|
||||
const executePromise = executePlan(
|
||||
{
|
||||
@@ -51,6 +43,7 @@ describe("test planner executor", () => {
|
||||
{
|
||||
env: { OPENCLAW_TEST_CLOSE_GRACE_MS: "10" },
|
||||
artifacts,
|
||||
spawn: spawnMock,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -93,13 +86,6 @@ describe("test planner executor", () => {
|
||||
}, 0);
|
||||
return child;
|
||||
});
|
||||
vi.doMock("node:child_process", () => ({
|
||||
spawn: spawnMock,
|
||||
}));
|
||||
|
||||
const { executePlan, createExecutionArtifacts } = await importFreshModule<
|
||||
typeof import("../../scripts/test-planner/executor.mjs")
|
||||
>(import.meta.url, "../../scripts/test-planner/executor.mjs?scope=collect-all");
|
||||
const artifacts = createExecutionArtifacts({});
|
||||
const report = await executePlan(
|
||||
{
|
||||
@@ -125,6 +111,7 @@ describe("test planner executor", () => {
|
||||
{
|
||||
env: {},
|
||||
artifacts,
|
||||
spawn: spawnMock,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -159,13 +146,6 @@ describe("test planner executor", () => {
|
||||
}, 0);
|
||||
return fakeChild;
|
||||
});
|
||||
vi.doMock("node:child_process", () => ({
|
||||
spawn: spawnMock,
|
||||
}));
|
||||
|
||||
const { executePlan, createExecutionArtifacts } = await importFreshModule<
|
||||
typeof import("../../scripts/test-planner/executor.mjs")
|
||||
>(import.meta.url, "../../scripts/test-planner/executor.mjs?scope=localstorage-file");
|
||||
const artifacts = createExecutionArtifacts({
|
||||
NODE_OPTIONS: "--max_old_space_size=4096 --localstorage-file",
|
||||
});
|
||||
@@ -193,6 +173,7 @@ describe("test planner executor", () => {
|
||||
NODE_OPTIONS: "--max_old_space_size=4096 --localstorage-file",
|
||||
},
|
||||
artifacts,
|
||||
spawn: spawnMock,
|
||||
},
|
||||
),
|
||||
).resolves.toMatchObject({
|
||||
|
||||
Reference in New Issue
Block a user