fix(ci): avoid TS2742 vitest mock export types

This commit is contained in:
Peter Steinberger
2026-02-15 01:29:38 +01:00
parent be57344b99
commit 301b3ff912
2 changed files with 7 additions and 8 deletions

View File

@@ -1,8 +1,7 @@
import { vi } from "vitest";
import type { MockFn } from "../test-utils/vitest-mock-fn.js";
// 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;
export const callGatewayMock: MockFn<(opts: unknown) => unknown> = vi.fn();
vi.mock("../gateway/call.js", () => ({
callGateway: (opts: unknown) => callGatewayMock(opts),
}));

View File

@@ -2,13 +2,13 @@ import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { afterAll, afterEach, beforeAll, beforeEach, vi } from "vitest";
import type { MockFn } from "../test-utils/vitest-mock-fn.js";
// Avoid exporting inferred vitest mock types (TS2742 under pnpm + d.ts emit).
export type NoopLogger = {
debug: ReturnType<typeof vi.fn>;
info: ReturnType<typeof vi.fn>;
warn: ReturnType<typeof vi.fn>;
error: ReturnType<typeof vi.fn>;
debug: MockFn;
info: MockFn;
warn: MockFn;
error: MockFn;
};
export function createNoopLogger(): NoopLogger {