diff --git a/src/infra/unhandled-rejections.fatal-detection.test.ts b/src/infra/unhandled-rejections.fatal-detection.test.ts index 7c8d97675..b9ff4557b 100644 --- a/src/infra/unhandled-rejections.fatal-detection.test.ts +++ b/src/infra/unhandled-rejections.fatal-detection.test.ts @@ -125,13 +125,16 @@ describe("installUnhandledRejectionHandler - fatal detection", () => { expect(consoleWarnSpy).toHaveBeenCalled(); }); - it("does NOT exit on generic errors without code", () => { + it("exits on generic errors without code", () => { const genericErr = new Error("Something went wrong"); process.emit("unhandledRejection", genericErr, Promise.resolve()); - expect(exitCalls).toEqual([]); - expect(consoleWarnSpy).toHaveBeenCalled(); + expect(exitCalls).toEqual([1]); + expect(consoleErrorSpy).toHaveBeenCalledWith( + "[clawdbot] Unhandled promise rejection:", + expect.stringContaining("Something went wrong"), + ); }); it("does NOT exit on connection reset errors", () => {