Skip to content

Commit f484b48

Browse files
authored
Give debugging sessions unique names (#904)
If we're testing in both frameworks we're going to start more than one debugging session. If both build configurations have the same name LLDB will replace the output of the first one in the Debug Console with the output of the second one. This means the user loses the debug output from the first session. If they each have a unique name the Debug Console gets a nice dropdown the user can switch between to see the output for both sessions. This approach has the caveat where VS Code doesn't seem to have an API to remove an old session with a different name from the dropdown. Specifically, if we do a debugging run of all tests in a XCTest+Swift Testing project this creates two sessions with, for instance, the names "XCTest" and "Swift Testing". However if then we run a single XCTest the "XCTest" debug session is updated but the old "Swift Testing" session sticks around in the dropdown with the output from the last run. Issue: #902
1 parent b13561c commit f484b48

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/TestExplorer/TestRunner.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,13 @@ export class TestRunner {
725725

726726
swiftTestBuildConfig.testType = TestLibrary.swiftTesting;
727727
swiftTestBuildConfig.preLaunchTask = null;
728+
729+
// If we're testing in both frameworks we're going to start more than one debugging
730+
// session. If both build configurations have the same name LLDB will replace the
731+
// output of the first one in the Debug Console with the output of the second one.
732+
// If they each have a unique name the Debug Console gets a nice dropdown the user
733+
// can switch between to see the output for both sessions.
734+
swiftTestBuildConfig.name = `Swift Testing: ${swiftTestBuildConfig.name}`;
728735
buildConfigs.push(swiftTestBuildConfig);
729736
}
730737
}
@@ -750,6 +757,7 @@ export class TestRunner {
750757

751758
xcTestBuildConfig.testType = TestLibrary.xctest;
752759
xcTestBuildConfig.preLaunchTask = null;
760+
xcTestBuildConfig.name = `XCTest: ${xcTestBuildConfig.name}`;
753761
buildConfigs.push(xcTestBuildConfig);
754762
}
755763
}

0 commit comments

Comments
 (0)