mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 15:01:41 +03:00
fix(ci): avoid TS2742 vitest mock export types
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
import { vi } from "vitest";
|
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 const callGatewayMock: MockFn<(opts: unknown) => unknown> = vi.fn();
|
||||||
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", () => ({
|
vi.mock("../gateway/call.js", () => ({
|
||||||
callGateway: (opts: unknown) => callGatewayMock(opts),
|
callGateway: (opts: unknown) => callGatewayMock(opts),
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ import fs from "node:fs/promises";
|
|||||||
import os from "node:os";
|
import os from "node:os";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { afterAll, afterEach, beforeAll, beforeEach, vi } from "vitest";
|
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 = {
|
export type NoopLogger = {
|
||||||
debug: ReturnType<typeof vi.fn>;
|
debug: MockFn;
|
||||||
info: ReturnType<typeof vi.fn>;
|
info: MockFn;
|
||||||
warn: ReturnType<typeof vi.fn>;
|
warn: MockFn;
|
||||||
error: ReturnType<typeof vi.fn>;
|
error: MockFn;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function createNoopLogger(): NoopLogger {
|
export function createNoopLogger(): NoopLogger {
|
||||||
|
|||||||
Reference in New Issue
Block a user