mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 09:24:45 +00:00
test: speed up cli and command suites
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Command } from "commander";
|
||||
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { repoInstallSpec } from "../../../test/helpers/bundled-plugin-paths.js";
|
||||
import { loggingState } from "../../logging/state.js";
|
||||
import { setCommandJsonMode } from "./json-mode.js";
|
||||
@@ -48,15 +48,6 @@ vi.mock("../plugin-registry.js", () => ({
|
||||
ensurePluginRegistryLoaded: ensurePluginRegistryLoadedMock,
|
||||
}));
|
||||
|
||||
const mockedModuleIds = [
|
||||
"../../globals.js",
|
||||
"../../runtime.js",
|
||||
"../banner.js",
|
||||
"../cli-name.js",
|
||||
"./config-guard.js",
|
||||
"../plugin-registry.js",
|
||||
];
|
||||
|
||||
let registerPreActionHooks: typeof import("./preaction.js").registerPreActionHooks;
|
||||
let originalProcessArgv: string[];
|
||||
let originalProcessTitle: string;
|
||||
@@ -70,13 +61,6 @@ beforeAll(async () => {
|
||||
({ registerPreActionHooks } = await import("./preaction.js"));
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
for (const id of mockedModuleIds) {
|
||||
vi.doUnmock(id);
|
||||
}
|
||||
vi.resetModules();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
originalProcessArgv = [...process.argv];
|
||||
|
||||
Reference in New Issue
Block a user