mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-13 10:11:20 +00:00
test: speed up cli and command suites
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
import process from "node:process";
|
||||
import { Command } from "commander";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { buildProgram } from "./build-program.js";
|
||||
import type { ProgramContext } from "./context.js";
|
||||
|
||||
const registerProgramCommandsMock = vi.fn();
|
||||
const createProgramContextMock = vi.fn();
|
||||
const configureProgramHelpMock = vi.fn();
|
||||
const registerPreActionHooksMock = vi.fn();
|
||||
const setProgramContextMock = vi.fn();
|
||||
const registerProgramCommandsMock = vi.hoisted(() => vi.fn());
|
||||
const createProgramContextMock = vi.hoisted(() => vi.fn());
|
||||
const configureProgramHelpMock = vi.hoisted(() => vi.fn());
|
||||
const registerPreActionHooksMock = vi.hoisted(() => vi.fn());
|
||||
const setProgramContextMock = vi.hoisted(() => vi.fn());
|
||||
|
||||
vi.mock("./command-registry.js", () => ({
|
||||
registerProgramCommands: registerProgramCommandsMock,
|
||||
@@ -29,8 +30,6 @@ vi.mock("./program-context.js", () => ({
|
||||
setProgramContext: setProgramContextMock,
|
||||
}));
|
||||
|
||||
const { buildProgram } = await import("./build-program.js");
|
||||
|
||||
describe("buildProgram", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
|
||||
Reference in New Issue
Block a user