test: speed up cli and command suites

This commit is contained in:
Peter Steinberger
2026-03-31 02:12:23 +01:00
parent 6b6ddcd2a6
commit 3f1d6fe147
83 changed files with 1161 additions and 1054 deletions

View File

@@ -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();