From 84d707582744f8338b704f303df6c25436d1c722 Mon Sep 17 00:00:00 2001 From: Christian Findlay <16697547+MelbourneDeveloper@users.noreply.github.com> Date: Fri, 20 Nov 2026 06:10:28 +1100 Subject: [PATCH] The Stop suite starts from no test-debug terminal: it waits for an earlier suite's still-settling run to close its terminal, and fails naming the leak if one never closes, instead of counting it as a ghost of its own --- .../vscode/src/test/suite/debug-test-kit.ts | 18 +++++++++++++++++- .../src/test/suite/debug-test-stop-e2e.test.ts | 7 ++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/editors/vscode/src/test/suite/debug-test-kit.ts b/src/editors/vscode/src/test/suite/debug-test-kit.ts index eb68472f..e339eed5 100644 --- a/src/editors/vscode/src/test/suite/debug-test-kit.ts +++ b/src/editors/vscode/src/test/suite/debug-test-kit.ts @@ -42,7 +42,7 @@ import { requireWorkspaceRoot, pollUntilResult, } from './test-helpers'; -import { COMMAND_MS } from './test-timeouts'; +import { COMMAND_MS, DEBUG_SESSION_MS } from './test-timeouts'; /** Wait for the actual terminal object to close, not an unrelated queue. */ export async function assertTerminalClosed(terminal: vscode.Terminal): Promise { @@ -55,6 +55,22 @@ export async function assertTerminalClosed(terminal: vscode.Terminal): Promise { + const left = await pollUntilResult( + async () => vscode.window.terminals.filter((terminal) => terminal.name === name).length, + (count) => count === 0, + DEBUG_SESSION_MS, + 100, + ); + assert.equal(left, 0, why); +} + /** Require exactly one named terminal and return the actual object owned by the run. */ export function assertOneTerminal( name: string, diff --git a/src/editors/vscode/src/test/suite/debug-test-stop-e2e.test.ts b/src/editors/vscode/src/test/suite/debug-test-stop-e2e.test.ts index e8bd532b..34cd9315 100644 --- a/src/editors/vscode/src/test/suite/debug-test-stop-e2e.test.ts +++ b/src/editors/vscode/src/test/suite/debug-test-stop-e2e.test.ts @@ -18,6 +18,7 @@ import { requireActive, type TestDebugFixture, assertTerminalClosed, + assertNoTerminalLeft, assertOneTerminal, assertDebugCache, } from './debug-test-kit'; @@ -112,7 +113,11 @@ for (const language of ['fsharp', 'csharp'] as const) { }); test('Stop ends its host and terminal, never retries, and the next Debug starts clean', async function () { - this.timeout(DEBUG_TEST_MS * 2); + this.timeout(DEBUG_TEST_MS * 3); + await assertNoTerminalLeft( + TEST_DEBUG_TERMINAL_NAME, + 'every earlier debug run closed its terminal once it settled', + ); const api = await activateTestExplorer(); await discoverSolution(api, fixture.solutionPath, [id, 'Other.Unselected']); const item = findItem(api.testController.items, id);