diff --git a/CHANGELOG.md b/CHANGELOG.md index c1977dbdd..678531df1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ - Prompt to cancel and replace the active test run if one is in flight ([#1774](https://github.com/swiftlang/vscode-swift/pull/1774)) - A walkthrough for first time extension users ([#1560](https://github.com/swiftlang/vscode-swift/issues/1560)) +### Fixed + +- Don't start debugging XCTest cases if the swift-testing debug session was stopped ([#1797](https://github.com/swiftlang/vscode-swift/pull/1797)) + ## 2.11.20250806 - 2025-08-06 ### Added diff --git a/src/TestExplorer/TestRunner.ts b/src/TestExplorer/TestRunner.ts index 6309dcdaf..847f45dc5 100644 --- a/src/TestExplorer/TestRunner.ts +++ b/src/TestExplorer/TestRunner.ts @@ -700,6 +700,10 @@ export class TestRunner { compositeToken.token ); + // If the user terminates a debugging session for swift-testing + // we want to prevent XCTest from starting. + const terminationListener = runner.onDebugSessionTerminated(() => compositeToken.cancel()); + // Register the test run with the manager folderContext.registerTestRun(runner.testRun, compositeToken); @@ -709,6 +713,8 @@ export class TestRunner { // Run the tests await runner.runHandler(); + terminationListener.dispose(); + // Run the post-run handler if provided if (postRunHandler) { await postRunHandler(runner);