fix(test): avoid vitest mock type inference issues

This commit is contained in:
Peter Steinberger
2026-02-15 01:06:02 +01:00
parent b84cd25537
commit 07fbf46091
3 changed files with 27 additions and 9 deletions

View File

@@ -1,6 +1,8 @@
import { vi } from "vitest";
export const callGatewayMock = vi.fn();
// Avoid exporting inferred vitest mock types (TS2742 under pnpm + d.ts emit).
export type CallGatewayMock = ((opts: unknown) => unknown) & ReturnType<typeof vi.fn>;
export const callGatewayMock: CallGatewayMock = vi.fn() as unknown as CallGatewayMock;
vi.mock("../gateway/call.js", () => ({
callGateway: (opts: unknown) => callGatewayMock(opts),
}));