Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions __tests__/cli.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import stripAnsi from "strip-ansi";

describe("cli tests", () => {
const originalArgv = process.argv;
const originalExitCode = process.exitCode;
Expand Down Expand Up @@ -248,10 +250,10 @@ describe("cli tests", () => {
]);
await new Promise<void>((resolve) => setImmediate(resolve));

expect(mockError).toHaveBeenCalledWith(
expect.stringContaining(
"[lint-md] The following options cannot be used with --stdin:\n--threads\n--max-file-size"
)
// chalk wraps each line of a multiline message in ANSI codes, so
// compare against the stripped text.
expect(stripAnsi(String(mockError.mock.calls[0][0]))).toBe(
"[lint-md] The following options cannot be used with --stdin:\n--threads\n--max-file-size"
);
expect(runStdinLint).not.toHaveBeenCalled();
expect(process.exitCode).toBe(1);
Expand Down