Skip to content

Commit 3e21b57

Browse files
committed
test(cli): stabilize entry failure output assertion
1 parent 0e75204 commit 3e21b57

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎src/entry.run-main.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { describe, expect, it, vi } from "vitest";
22
import { ExpectedCliError } from "./cli/failure-output.js";
33
import { runMainOrRootHelp } from "./entry.js";
4+
import { enableConsoleCapture } from "./logging.js";
45

56
describe("entry run-main boundary", () => {
67
it("retains JSON console routing through process finalization", async () => {
@@ -25,6 +26,9 @@ describe("entry run-main boundary", () => {
2526
humanOutput: message,
2627
machineOutput: message,
2728
});
29+
// Establish the production console owner before spying. Calling the entry path may
30+
// otherwise replace this spy when another test has reset console-capture state.
31+
enableConsoleCapture();
2832
const errorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
2933
process.exitCode = undefined;
3034

0 commit comments

Comments
 (0)