Skip to content
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

Coverage disappears when tests run through test explorer #212805

Closed
Tracked by #212907
MarkusAmshove opened this issue May 15, 2024 · 4 comments
Closed
Tracked by #212907

Coverage disappears when tests run through test explorer #212805

MarkusAmshove opened this issue May 15, 2024 · 4 comments
Assignees

Comments

@MarkusAmshove
Copy link

MarkusAmshove commented May 15, 2024

Does this issue occur when all extensions are disabled?: Yes/No
No (because coverage is

  • VS Code Version: 1.88.1 and 1.90 insiders
  • OS Version: SLED 15 and Windows 10

Steps to Reproduce:

I've developed an extension that uses the new coverage API from 1.88 and I get the following problem:

  • When the coverage profile is run through the test explorer, then the coverage data is appearing for very short time before it disappears

coverage-flashing

  • When the coverage profile is run through a custom command of mine, then the coverage will remain available

coverage-staying

I've made sure to debug the input parameter to the runHandler in both cases and they're both identical.

The only difference I can see is the callstack in case 1 (explorer):
CallstackExplorer

vs case 2 (command):
CallstackCommand

When I set a breakpoint at the very last curly brace of my run handler, then the coverage will stay until somewhere in the callstack which I can't look into:

coverage-halt

I don't know what I can still try out to resolve this issue.
The coverage is added correctly, as it stays when the program halts and also stays forever when executed through the code lens command.

@connor4312
Copy link
Member

Are you able to share the source code of your extension so I can look into this a bit?

@MarkusAmshove
Copy link
Author

While creating a small repro extension, I noticed that I can find the coverage of the run initiated through the text explorer through the Test Results view:

test-results

While this doesn't explain why the coverage is appearing for a split second before closing itself again, using the command testing.openCoverage shows a message that no coverage data is available:

nocoverage

My settings.json is the following in the tests:

{
    "git.openRepositoryInParentFolders": "never",
    "workbench.startupEditor": "none",
}

@connor4312
Copy link
Member

I see that you have duplicate test runs. This is probably because you're creating a separate TestRunRequest rather than what VS Code provides to you. I recommend not doing this, but this behavior should also be fixed with #235758

@MarkusAmshove
Copy link
Author

Thank you, the hint with the separate TestRunRequest was the issue that I didn't find myself. I cloned the request that was passed to me and I don't know why.
Using the original request works as expected :-)

@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Jan 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants