chore: Fix types in tests 10/N.

This commit is contained in:
cpojer
2026-02-17 11:17:14 +09:00
parent 95f344e433
commit 058eb85762
5 changed files with 35 additions and 19 deletions

View File

@@ -1,4 +1,5 @@
import { vi } from "vitest";
import type { RuntimeEnv } from "../runtime.js";
import type { MockFn } from "../test-utils/vitest-mock-fn.js";
export const baseConfigSnapshot = {
@@ -13,15 +14,18 @@ export const baseConfigSnapshot = {
};
export type TestRuntime = {
log: MockFn;
error: MockFn;
exit: MockFn;
log: MockFn<RuntimeEnv["log"]>;
error: MockFn<RuntimeEnv["error"]>;
exit: MockFn<RuntimeEnv["exit"]>;
};
export function createTestRuntime(): TestRuntime {
const log = vi.fn() as MockFn<RuntimeEnv["log"]>;
const error = vi.fn() as MockFn<RuntimeEnv["error"]>;
const exit = vi.fn((_: number) => undefined) as MockFn<RuntimeEnv["exit"]>;
return {
log: vi.fn(),
error: vi.fn(),
exit: vi.fn(),
log,
error,
exit,
};
}