diff --git a/src/cli/gateway-cli/run.option-collisions.test.ts b/src/cli/gateway-cli/run.option-collisions.test.ts index b6b6b9d4f0b..e57a30bdd15 100644 --- a/src/cli/gateway-cli/run.option-collisions.test.ts +++ b/src/cli/gateway-cli/run.option-collisions.test.ts @@ -31,7 +31,13 @@ const runGatewayLoop = vi.fn(async ({ start }: { start: GatewayLoopStart }) => { const normalizeStateDirEnv = vi.fn((_env?: NodeJS.ProcessEnv) => undefined); const pinConfigDir = vi.fn((_env?: NodeJS.ProcessEnv) => undefined); const pinRuntimePaths = vi.fn((_env?: NodeJS.ProcessEnv) => undefined); -const loadGlobalRuntimeDotEnvFiles = vi.fn((_opts?: unknown) => undefined); +type RuntimeDotEnvLoadResult = { + gatewayEnvAppliedKeys: string[]; + stateEnvAppliedKeys: string[]; +}; +const loadGlobalRuntimeDotEnvFiles = vi.fn< + (_opts?: unknown) => RuntimeDotEnvLoadResult | undefined +>(() => undefined); const beforeRun = vi.fn(async () => { callOrder.push("bootstrap"); }); diff --git a/src/cli/program/preaction.test.ts b/src/cli/program/preaction.test.ts index 7c36c647195..b65f3ae7358 100644 --- a/src/cli/program/preaction.test.ts +++ b/src/cli/program/preaction.test.ts @@ -10,7 +10,14 @@ const DISCORD_REPO_INSTALL_SPEC = repoInstallSpec("discord"); const setVerboseMock = vi.fn(); const emitCliBannerMock = vi.fn(); -const ensureConfigReadyMock = vi.fn(async () => {}); +type EnsureConfigReadyOptions = { + beforeStateMigrations?: () => Promise; + commandPath?: string[]; + requireConfig?: boolean; +}; +const ensureConfigReadyMock = vi.fn<(_opts: EnsureConfigReadyOptions) => Promise>( + async () => {}, +); const ensurePluginRegistryLoadedMock = vi.fn(); const routeLogsToStderrMock = vi.fn(); const prepareGatewayRunBootstrapMock = vi.fn(async () => true); diff --git a/src/cli/run-main.exit.test.ts b/src/cli/run-main.exit.test.ts index 685aa20c957..faee9f81306 100644 --- a/src/cli/run-main.exit.test.ts +++ b/src/cli/run-main.exit.test.ts @@ -77,8 +77,18 @@ const runCrestodianMock = vi.hoisted(() => vi.fn<(options?: unknown) => Promise>(async () => {}), ); const commanderParseAsyncMock = vi.hoisted(() => vi.fn(async () => {})); -const addGatewayRunCommandMock = vi.hoisted(() => vi.fn((command: unknown) => command)); -const ensureCliExecutionBootstrapMock = vi.hoisted(() => vi.fn(async () => {})); +type GatewayRunCommandHooks = { + beforeRun?: (opts: { reset?: boolean }) => Promise; +}; +type CliExecutionBootstrapOptions = { + beforeStateMigrations?: () => Promise; +}; +const addGatewayRunCommandMock = vi.hoisted(() => + vi.fn<(command: unknown, hooks?: GatewayRunCommandHooks) => unknown>((command) => command), +); +const ensureCliExecutionBootstrapMock = vi.hoisted(() => + vi.fn<(_opts: CliExecutionBootstrapOptions) => Promise>(async () => {}), +); const emitCliBannerMock = vi.hoisted(() => vi.fn()); const enableConsoleCaptureMock = vi.hoisted(() => vi.fn()); const progressDoneMock = vi.hoisted(() => vi.fn()); diff --git a/src/commands/doctor-config-preflight.state-migration.test.ts b/src/commands/doctor-config-preflight.state-migration.test.ts index 1c4561cc5f2..eaebd9673d4 100644 --- a/src/commands/doctor-config-preflight.state-migration.test.ts +++ b/src/commands/doctor-config-preflight.state-migration.test.ts @@ -52,7 +52,9 @@ describe("runDoctorConfigPreflight state migration", () => { }); it("runs the startup guard immediately before the first state mutation", async () => { - const beforeStateMigrations = vi.fn(async () => true); + const beforeStateMigrations = vi.fn<(_snapshot?: unknown) => Promise>( + async () => true, + ); await runDoctorConfigPreflight({ migrateLegacyConfig: false, diff --git a/src/infra/shell-env.test.ts b/src/infra/shell-env.test.ts index b71c6dffb8b..cae9d89fd28 100644 --- a/src/infra/shell-env.test.ts +++ b/src/infra/shell-env.test.ts @@ -405,7 +405,7 @@ describe("shell env fallback", () => { exec: (() => Buffer.from( "OPENAI_API_KEY=openai-shell\0ANTHROPIC_API_KEY=anthropic-shell\0", - )) as Parameters[0]["exec"], + )) as unknown as Parameters[0]["exec"], }); clearShellEnvAppliedKeys(["OPENAI_API_KEY"]);