-
Notifications
You must be signed in to change notification settings - Fork 29.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API: Correlate debug sessions and test runs. #214486
Comments
This is now implemented behind the usual proposed shenanigans. Let me know how it works or if folks think anything is missing. This is a simple API so I think we could finalize it next iteration. @mxschmitt I think you mentioned this before, + @jdneo @DanTup @eleanorjboyd |
We could technically make this work without API in some cases by using AsyncLocalStorage to associate sessions started from calls to the runHandlers. But I think we still want API as that is a rather exotic feature that can be defeated though various means. |
In the current implementation, hitting the restart button won't touch the debug session at all but will instead cancel the test run, wait for the run to complete, and then immediately start a new run with the same parameters: vscode/src/vs/workbench/contrib/debug/browser/debugService.ts Lines 846 to 857 in b814ff2
You should be able to keep updating states and such until you call |
In Dart, we were already handling debug session ends and calling However, restart doesn't work great - because it seems to end the test run, then start a new debug session that is not tied to a test run (so you don't get the results recorded). It's not clear to me if your fix here will solve that, but I wonder if there are going to have issues with test runs where VS Code doesn't have all of the related data. We discussed this before in #144169 (comment) about "Test: Rerun Last Run" not working because of this. If we let VS Code handle restarting test runs by just calling |
As I debug it I am still seeing |
Yep, please send your branch, thanks! |
Thanks, fixed |
Friendly ping! Looks like this issue requires some further steps to be verified. Please provide us with the steps necessary to verify this issue. |
|
@connor4312 I'm not sure if you wanted me to verify anything, but I still don't completely understand the functionality here - see my notes above at #214486 (comment) |
This doesn't affect how debug sessions stop at the moment, only how they restart. When a restart happens, the old test run request is cancelled, and once it ends a new test run request comes in with an identical profile and set of tests as was initially used to start the first run. This should fix the issue of the second, 'untracked' debug session. It sounds like profiles are the right mechanic for your use case. I made some improvements to the case of "if they should only apply to specific files or folders" that you mentioned in your original comment a couple years ago. I you would like some UX improvements to make them more viable I would be happy to discuss 🙂 |
Yep, understood. But in the case where a test run is created by us (so we can record test results) but doesn't contain all of the information to run a specific set of tests:
Then won't Restart now end up running the entire set of tests, rather than just restarting the debug session as it did before (which might record results against the original run, but at least ran the correct set of tests)? I'm assuming if I never set |
Yea -- just like the "rerun" actions would (which as you previously mentioned aren't good in your current setup.)
Yep that's right
Just a query which captures most things, but not everything. Notably I think:
|
debug finalize testRun in DebugSessionOptions Closes microsoft#214486
Hi, sorry for the late reply. I tested the new api today, I can still hit |
When restarting when a test run is provided, the test run is cancelled. Usually this will result in the extension stopping the debug session which will then trigger |
Currently, debug sessions and test runs live in two different worlds. This leads to some confusion, because stopping or restarting a debug session using the debug toolbar doesn't stop or restart the test run. Several extension authors have raised this as a pain point.
I propose a simple API that would allow the editor to correlate the two:
Then it can be passed in
vscode.debug.startDebugging(folder, launchConfig, { testRun: myTestRun });
The text was updated successfully, but these errors were encountered: