fix: suppress execution output on stdout

This commit is contained in:
gsxdsm
2026-04-11 21:13:16 -07:00
parent b6dda1296a
commit bddf86346e
9 changed files with 89 additions and 53 deletions

View File

@@ -27,10 +27,11 @@ describe("createLogger", () => {
errorSpy.mockRestore();
});
it("formats log output as [prefix] message", () => {
it("formats log output as [prefix] message on stderr", () => {
const logger = createLogger("test");
logger.log("hello world");
expect(logSpy).toHaveBeenCalledWith("[test] hello world");
expect(logSpy).not.toHaveBeenCalled();
expect(errorSpy).toHaveBeenCalledWith("[test] hello world");
});
it("formats warn output as [prefix] message", () => {
@@ -52,36 +53,36 @@ describe("createLogger", () => {
expect(errorSpy).toHaveBeenCalledWith("[test] failed:", err);
});
it("delegates log to console.log, warn to console.warn, error to console.error", () => {
it("keeps log output off stdout", () => {
const logger = createLogger("x");
logger.log("a");
logger.warn("b");
logger.error("c");
expect(logSpy).toHaveBeenCalledTimes(1);
expect(logSpy).not.toHaveBeenCalled();
expect(warnSpy).toHaveBeenCalledTimes(1);
expect(errorSpy).toHaveBeenCalledTimes(1);
expect(errorSpy).toHaveBeenCalledTimes(2);
});
it("pre-built instances use correct prefixes", () => {
schedulerLog.log("tick");
expect(logSpy).toHaveBeenCalledWith("[scheduler] tick");
expect(errorSpy).toHaveBeenCalledWith("[scheduler] tick");
executorLog.log("run");
expect(logSpy).toHaveBeenCalledWith("[executor] run");
expect(errorSpy).toHaveBeenCalledWith("[executor] run");
triageLog.log("spec");
expect(logSpy).toHaveBeenCalledWith("[triage] spec");
expect(errorSpy).toHaveBeenCalledWith("[triage] spec");
mergerLog.log("merge");
expect(logSpy).toHaveBeenCalledWith("[merger] merge");
expect(errorSpy).toHaveBeenCalledWith("[merger] merge");
worktreePoolLog.log("prune");
expect(logSpy).toHaveBeenCalledWith("[worktree-pool] prune");
expect(errorSpy).toHaveBeenCalledWith("[worktree-pool] prune");
reviewerLog.log("review");
expect(logSpy).toHaveBeenCalledWith("[reviewer] review");
expect(errorSpy).toHaveBeenCalledWith("[reviewer] review");
remoteNodeLog.log("stream");
expect(logSpy).toHaveBeenCalledWith("[remote-node] stream");
expect(errorSpy).toHaveBeenCalledWith("[remote-node] stream");
});
});