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);