Vscode-jest: Improving coverage display?

Created on 23 Mar 2018  路  9Comments  路  Source: jest-community/vscode-jest

It should be nice to have display options like the ones offered by coverage-gutters

coverage-gutters-features sample1

coverage-gutters-features sample2

Maybe an integration with that plugin can be made rather than doing the same work?

enhancement coverage

All 9 comments

@Guymestef coverage-gutters seems to work perfectly well with this extension installed. I don't see how this extension could integrate with coverage-gutters as coverage-gutters is driven from your Jest config producing an lcov.info file.

Since vscode-jest has a feature to display coverage, it was more a question about having something as good as coverage-gutters than an integration.
I found out coverage-gutters, because for me the actual vscode-jest coverage display is too obtrusive by using a background color on the whole line, and so I looked to have another way to display it.
But I think the best would be to have this out of the box when using vscode-jest, rather than installing another plugin.

The ground work is there for us to choose code coverage formatters but we only have the default right now and no setting to choose between them. If you'd like to create a "coverage formatter" that integrates with coverage-gutters I'm happy to help with the PR. The formatter should extend the AbtractFormatter in src/Coverage/Formatters and define the format and clear methods. If coverage-gutters has an API or commands to work with then it should be relatively straight forward.

I looked at the DefaultFormatter and at how coverage-gutters is doing the job. It's just a matter of options passed to createTextEditorDecorationType and a filter to get partially covered branches.
It should be easily done thanks to the AbtractFormatter 馃憤

I'll try to do a PR when I'll find some time to work on it

I've created a PR as a first version of a GutterFormatter

Is this still a work-in-progress? I tried enabling GutterFormatter and it changed the color of the highlights (actually making the code pretty hard to read) but did not put anything in the gutter.

@Guymestef have you had any time to improve the coverage gutters to actually be gutters?

I've made some improvements with this PR:

  • settings to choose background colors (default none except for partially covered lines)
  • settings to choose image to display in the gutter

For the gutter images, I think it's currently not working because the images are not embedded with the extension.
Anyone know how to include them?
I moved them inside the images folder in case it's just a convention to put them there.
But maybe we need to add a copy assets task to the pre-publish task?

At least with the settings, we should be able to use local images as a workaround...

What's the state of this? I tried enabling GutterFormatter but did not get any highlighting in the gutter

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FDiskas picture FDiskas  路  3Comments

orta picture orta  路  4Comments

ryanlittle picture ryanlittle  路  3Comments

orta picture orta  路  5Comments

radfahrer picture radfahrer  路  3Comments