From 62ef8cc8cde1722cf1647ba59f351bdb52fd9b43 Mon Sep 17 00:00:00 2001 From: Horizontal42 <75383519+Horizontal42@users.noreply.github.com> Date: Sun, 9 Aug 2026 15:57:33 +0300 Subject: [PATCH] assert console availability directly instead of matching an error message --- src/extensions.test.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/extensions.test.ts b/src/extensions.test.ts index f888ed4..104eda9 100644 --- a/src/extensions.test.ts +++ b/src/extensions.test.ts @@ -130,13 +130,10 @@ describe("extensions", () => { it("has no host globals inside the sandbox", async () => { await runExtensions(mockEngine as SumEngine, [ - { name: "probe", code: "if (typeof window !== 'undefined' || typeof fetch !== 'undefined') throw new Error('leak');" }, - { name: "log", code: "console.log('hi');" }, + { name: "probe", code: "if (typeof window !== 'undefined' || typeof fetch !== 'undefined' || typeof console !== 'undefined') throw new Error('leak');" }, ]); - expect(consoleErrorSpy).toHaveBeenCalledTimes(1); - expect(consoleErrorSpy.mock.calls[0][0]).toBe("extension log failed:"); - expect(consoleErrorSpy.mock.calls[0][1].message).toMatch(/console/); + expect(consoleErrorSpy).not.toHaveBeenCalled(); }); it("interrupts an infinite loop at load time", async () => {