-
-
Notifications
You must be signed in to change notification settings - Fork 95
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 clears previous file results after each run #336
Comments
This is also how it works with Vitest CLI, no? |
Seems to be inconsistent. If you make a change to a test file, it only shows you the results of the files covered by that test. If you make a change to a non-test file, it shows you the results of the previous coverage runs too. There is a Regardless, it feels very weird that coverage information for files randomly disappears when I edit a completely unrelated file. The actual test results stay unchanged, so shouldn't the coverage stay unchanged as well? |
The change to a file triggers a new test run which has a different coverage information. You can still see the previous coverage data by clicking on the previous test run in “Test Results” window |
Seems like the watching isn't actually updating coverage information at all for me, even though I have that enabled in the watcher options. It only updates the coverage when I manually press "run with coverage" on the test again. Oddly, at some point during my testing, the coverage for a certain file completely disappeared and would not come back no matter what I did. I don't have consistent reproduction steps for this yet, but I'll reply back if I can figure some out. It doesn't seem like there are any logs shown for anything related to coverage. Having those would definitely help narrow down what the issue is if you're able to add them. |
Does it work better with only the coverage profile selected? Also, can you describe the workflow you expect? Starting from the very beginning ("click on continues run", I presume?) The coverage is related to the test run. You can see all test runs on the right side in "Test Results" panel. Since you run only a single test on change, it shows only related coverage. I say this is expected behaviour. You can still see all coverage in the previous test run if you double-click on that run. |
The coverage info is also shown in the file tree, which is where I'd be looking most of the time. The ideal workflow is this:
I think it's ok that the test results panel only shows the coverage that was changed by that test, that makes sense to me. But the file tree should continue to show the coverage information for the unchanged files. |
There is no such thing in the VSCode API as showing something in one place, but not in another. The whole interface shows the latest test run by default unless you select the test run on the right-side panel. So we either show the test coverage (like now), or all accumulated coverage. |
I think the best option for the interim would be to add an option to control which behavior to use. Might be something to bring up to the VSCode team though, feels to me like there should be some way to persist coverage info in the file explorer while only showing the relevant files in the test results. |
Vitest doesn't support this at the moment: vitest-dev/vitest#5521 (comment) |
Describe the bug
With the new coverage reporting, the results for all previous files gets cleared when it runs again, even if the run is for a different file. This is especially noticeable when using watch mode.
Reproduction
Output
The text was updated successfully, but these errors were encountered: