From db22b98659a238633d520f7890f4ef89846bab9f Mon Sep 17 00:00:00 2001 From: can1357 Date: Fri, 7 Aug 2026 13:23:47 +0200 Subject: [PATCH] test(coding-agent): cover js debug install guidance --- .../test/debug/dap-launch-failures.test.ts | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/packages/coding-agent/test/debug/dap-launch-failures.test.ts b/packages/coding-agent/test/debug/dap-launch-failures.test.ts index d7d77bd26..a10a55626 100644 --- a/packages/coding-agent/test/debug/dap-launch-failures.test.ts +++ b/packages/coding-agent/test/debug/dap-launch-failures.test.ts @@ -862,6 +862,36 @@ describe("DebugTool launch validation", () => { } }); + it("shows supported install options when the JavaScript debug adapter is unavailable", async () => { + const launchSpy = spyOn(dapModule, "selectLaunchAdapter").mockReturnValue({ + kind: "unavailable", + adapterName: "js-debug-adapter", + command: "js-debug-adapter", + }); + try { + const cwd = await fs.mkdtemp(path.join(os.tmpdir(), "omp-debug-js-debug-hint-")); + try { + await fs.writeFile(path.join(cwd, "main.js"), "console.log('hi');\n"); + const session: ToolSession = { + cwd, + hasUI: false, + getSessionFile: () => null, + getSessionSpawns: () => "*", + settings: Settings.isolated({ "debug.enabled": true }), + }; + const tool = new DebugTool(session); + + await expect(tool.execute("call", { action: "launch", program: "main.js" })).rejects.toThrow( + /Mason.*release tarball.*JS_DEBUG_DAP_SERVER/, + ); + } finally { + await removeWithRetries(cwd); + } + } finally { + launchSpy.mockRestore(); + } + }); + it("points to DAP configuration when a custom adapter command is unavailable", async () => { const launchSpy = spyOn(dapModule, "selectLaunchAdapter").mockReturnValue({ kind: "unavailable",