fix(ci): avoid TS2742 vitest mock export types
This commit is contained in:
@@ -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),
|
||||
}));
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user