jest-community / vscode-jest

The optimal flow for Jest based testing in VS Code
MIT License
2.84k stars 294 forks source link

[FEATURE] Support native VS Code code coverage display #1186

Closed eliasm307 closed 1 month ago

eliasm307 commented 1 month ago

Is your feature request related to a problem? Please describe.

VS Code has some native support for showing code coverage ie https://code.visualstudio.com/docs/editor/testing#_test-coverage which allows coverage to be shown:

Currently it seems this extension has a custom implementation for showing coverage inline and with an overlay, but the native functionality would be useful also, especially the file explorer coverage which makes it easier to see overall coverage of files/folders etc

Describe the solution you'd like

Coverage used by the extension should also be exposed via the native VS Code coverage functionality.

Describe alternatives you've considered

N/A

Additional context

Examples of the native code coverage views:

In test explorer:

image

In file explorer (with coverage per file and folder):

image

VS Code API for test coverage: https://code.visualstudio.com/api/extension-guides/testing#test-coverage

connectdotz commented 1 month ago

The current plan is to deprecate the existing coverage implementation (prior to v6.3.0) in favor of the new native vscode test coverage interface (see pre-release v6.3.0). The native VSCode interface is more dynamic and less intrusive, in my opinion. I'd love to hear your thoughts on this direction, especially if you have any specific concerns or suggestions.

eliasm307 commented 1 month ago

@connectdotz I've been using the pre-release version of the extension the last few days and the native coverage functionality is pretty good.

My opinion is that deprecating the current custom coverage functionality or at least offering an option to turn it off (as it shows overlapping coverage with the native coverage) is a good idea.

The native coverage offers all the functionality that the current coverage does (ie gutter and in-line coverage) but in a better way and with more features.

In terms of maintenance I would imagine the native coverage would be better for you guys as you basically get features for free as the native coverage will improve over time and the vs code will cover some of the bug fixes etc and less code means less to maintain.

So generally, I'm quite happy with the native coverage functionality so far

eliasm307 commented 1 month ago

@connectdotz I've been using the re-release version of the extension and the native coverage functionality is pretty good.

My opinion is that deprecating the current custom coverage functionality or at least offering an option to turn it off (as it shows overlapping coverage with the native coverage) is a good idea.

The native coverage offers all the functionality that the current coverage does (ie gutter and in-line coverage) but in a better way.

In terms of maintenance I would imagine the native coverage would be better for you guys as you basically get features for free as the native coverage will improve over time and the vs code will cover some of the bug fixes etc and less code means less to maintain.

So generally, I'm quite happy with the native coverage functionality so far

Also regarding this issue, looks like the next version will meet my requirements so I'll close