test: preload doctor command in migration suites

This commit is contained in:
Peter Steinberger
2026-02-22 15:11:14 +00:00
parent c42b0b2dfc
commit 13d3758efd
2 changed files with 2 additions and 4 deletions

View File

@@ -17,6 +17,7 @@ import {
import "./doctor.fast-path-mocks.js";
const DOCTOR_MIGRATION_TIMEOUT_MS = 20_000;
const { doctorCommand } = await import("./doctor.js");
describe("doctor command", () => {
it("does not add a new gateway auth token while fixing legacy issues on invalid config", async () => {
@@ -34,7 +35,6 @@ describe("doctor command", () => {
legacyIssues: [{ path: "routing.allowFrom", message: "legacy" }],
});
const { doctorCommand } = await import("./doctor.js");
const runtime = createDoctorRuntime();
migrateLegacyConfig.mockReturnValue({
@@ -78,7 +78,6 @@ describe("doctor command", () => {
serviceIsLoaded.mockResolvedValueOnce(false);
serviceInstall.mockClear();
const { doctorCommand } = await import("./doctor.js");
await doctorCommand(createDoctorRuntime());
expect(uninstallLegacyGatewayServices).not.toHaveBeenCalled();
@@ -108,7 +107,6 @@ describe("doctor command", () => {
mockDoctorConfigSnapshot();
const { doctorCommand } = await import("./doctor.js");
await doctorCommand(createDoctorRuntime());
expect(runGatewayUpdate).toHaveBeenCalledWith(expect.objectContaining({ cwd: root }));

View File

@@ -2,6 +2,7 @@ import { describe, expect, it, vi } from "vitest";
import { readConfigFileSnapshot, writeConfigFile } from "./doctor.e2e-harness.js";
const DOCTOR_MIGRATION_TIMEOUT_MS = 20_000;
const { doctorCommand } = await import("./doctor.js");
describe("doctor command", () => {
it(
@@ -31,7 +32,6 @@ describe("doctor command", () => {
legacyIssues: [],
});
const { doctorCommand } = await import("./doctor.js");
const runtime = { log: vi.fn(), error: vi.fn(), exit: vi.fn() };
await doctorCommand(runtime, { nonInteractive: true, repair: true });