Skip to content

Commit 1716013

Browse files
Mock chalk in help output test
Co-authored-by: Josh Goldberg ✨ <[email protected]>
1 parent 07d413c commit 1716013

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: src/bin/help.test.ts

+10
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ import { SpyInstance, beforeEach, describe, expect, it, vi } from "vitest";
33

44
import { logHelpText } from "./help.js";
55

6+
function makeProxy<T extends object>(receiver: T): T {
7+
return new Proxy(receiver, {
8+
get: () => makeProxy((input: string) => input),
9+
});
10+
}
11+
12+
vi.mock("chalk", () => ({
13+
default: makeProxy({}),
14+
}));
15+
616
let mockConsoleLog: SpyInstance;
717

818
describe("logHelpText", () => {

0 commit comments

Comments
 (0)