|
1 | 1 | /** |
2 | | - * Real MCP -> Delve -> Go coverage for issue #753. Delve never sends a DAP |
3 | | - * `exited` event; it prints "Process N has exited with status S" to the |
4 | | - * console — under noDebug before `terminated`, in debug mode only in reply |
5 | | - * to `disconnect` — and the proxy reads that line back so `exitCode` appears |
6 | | - * like every other language's. Runs in CI (Go 1.21 + dlv 1.24.2 on ubuntu |
7 | | - * and windows) — the first CI-run test that spawns real Delve; `dist/` must |
8 | | - * be built (CI builds before the integration project). |
| 2 | + * Real MCP -> Delve -> Go coverage for issue #753: the debuggee's exit code |
| 3 | + * reaches the launch result and list_debug_sessions. Delve before 1.27 never |
| 4 | + * sends a DAP `exited` event; it prints "Process N has exited with status S" |
| 5 | + * to the console — under noDebug before `terminated`, in debug mode only in |
| 6 | + * reply to `disconnect` — and the proxy reads that line back. Delve 1.27+ |
| 7 | + * sends `exited` itself (go-delve/delve#4371), so the proxy's early |
| 8 | + * disconnect never fires and the status line, printed only at teardown, no |
| 9 | + * longer reaches get_output. The tests assert the exit code, which both |
| 10 | + * paths must produce, not the mechanism. CI runs this file on dlv 1.24.2 |
| 11 | + * (Go 1.21, ubuntu and windows: the console-line path) and on the go-current |
| 12 | + * job (the native `exited` path); `dist/` must be built (CI builds before the |
| 13 | + * integration project). |
9 | 14 | * |
10 | | - * The fixture is its own Go module pinned to `go 1.21`: dlv 1.24.2 accepts |
11 | | - * binaries built by Go 1.21–1.24 only, and the root examples/go module pins a |
12 | | - * newer Go. A developer whose local Go is newer than their dlv's window fails |
| 15 | + * The fixture is its own Go module pinned to `go 1.21` so the oldest pinned |
| 16 | + * Delve can build it: dlv 1.24.2 accepts binaries built by Go 1.21–1.24 |
| 17 | + * only. A developer whose local Go is newer than their dlv's window fails |
13 | 18 | * (not skips) this test — upgrade dlv. |
14 | 19 | */ |
15 | 20 | import { afterEach, beforeEach, describe, expect, it } from 'vitest'; |
@@ -102,18 +107,17 @@ describe.skipIf(!hasGo)('Go exit code from Delve\'s console status line (issue # |
102 | 107 | await expect.poll(async () => (await listedSession())?.exitCode, { timeout: 30_000 }).toBe(expected); |
103 | 108 | } |
104 | 109 |
|
105 | | - it('reports a non-zero exit code in debug mode, where Delve prints the status only in reply to disconnect', async (ctx) => { |
| 110 | + it('reports a non-zero exit code in debug mode', async (ctx) => { |
106 | 111 | await launchAndExpectExit({ scriptPath: program, args: ['7'], dapLaunchArgs: { stopOnEntry: false, cwd: fixtureDir } }, 7, ctx); |
107 | 112 | const text = await outputText(); |
108 | 113 | expect(text).toContain('exit_code fixture: exiting with status 7'); |
109 | | - expect(text).toMatch(/has exited with status 7/); |
110 | 114 | }, 90_000); |
111 | 115 |
|
112 | 116 | it('reports exit code 0 for a clean run in debug mode', async (ctx) => { |
113 | 117 | await launchAndExpectExit({ scriptPath: program, dapLaunchArgs: { stopOnEntry: false, cwd: fixtureDir } }, 0, ctx); |
114 | 118 | }, 90_000); |
115 | 119 |
|
116 | | - it('reports the exit code under noDebug, where Delve prints the status before terminated', async (ctx) => { |
| 120 | + it('reports the exit code under noDebug', async (ctx) => { |
117 | 121 | // Delve runs a noDebug target through Go's exec, so on Windows the binary needs its .exe. |
118 | 122 | const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'mcp-go-exit-')); |
119 | 123 | try { |
|
0 commit comments