Coverage Overlay not highlighting the same as coverage/index.html
See original GitHub issueEnvironment
node -v
: v8.11.3
npm -v
: 5.6.0
Operating system: windows10
Prerequisite
- are you able to run jest test from command line? yes
- how do you run your tests from command line?
yarn run testjest:watch --coverage --runTestsByPath src/app/game/game-a.service.spec.ts
Steps to Reproduce
a sample repo branch with the problem https://github.com/nasreddineskandrani/full-example-angular/tree/jest-playaround
commands:
yarn install yarn run testjest:watch – --coverage
for the same test run if i remove the test in my spec file for the false
branch in game-a.service.spec.ts
index.html coverage:
overlay coverage:
you can see that the true
branch is still highlighed by the overlay in vscode => when index.html
coverage is not highlihgting this branch.
Relevant Debug Info
i did not debug it yet.
Expected Behavior
coverage/index.html and coverage overlay in vscode are the same
Actual Behavior
covergae/index.html and coverage overlay in vscode are NOT the same
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6
Top Results From Across the Web
Enabling Jest Code Coverage Overlay in VS Code - YouTube
This video guides you through enabling Jest code coverage overlay in VS Code. This include specific instructions for Lightning Web ...
Read more >Viewing code coverage results - IBM
You can view your code coverage results in either a Workbench , HTML or PDF report or within the editor. By default, Workbench...
Read more >Clearing coverage highlighting in Eclipse - java - Stack Overflow
For people who are not able to find the coverage view , follow these steps : Go to Windows Menu bar > Show...
Read more >Full code-coverage with Jest - tsmx
A guided tour on how to achieve the most complete code-coverage with Jest in your NodeJS projects and an some thoughts on why...
Read more >Health Insurance Coverage in the United States: 2020
More information is available at <www.medicaid.gov/state-overviews/index.html>. Note: The estimates by type of coverage are not mutually exclusive: people ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@nasreddineskandrani in your sample repo, you have tested the
if
path by evaluatingbut you didn’t evaluate the hidden
else
path, which should returnsfalse
. Therefore you have only partially tested your branch. TheE
marker in the index.html means missing coverage onElse
path; it will put a markerI
for missingIf
path, you can play with it to see that effect.Just to be sure, the index.html (Istanbul report) is telling you the branch is not fully covered, it just didn’t use the red marker but the
E
. Actually there are many more types of “missing coverage” the report uses: How do I rea an Istanbul Coverage Report?.I think your suggestion to adopt the same report scheme is good, we can certainly use the same color scheme, provided they look right in vscode editor (lite/dark mode). However, we probably won’t use the
E
orI
marker, as they will interfere with code formating since we are dealing with text editors here, unlink the report is a read-only HTML page… That is why I am thinking of using different colors to represent them, I am all ears if you have other suggestions…Hi, I looked at the sample repo today, this is an interesting use case since this branch is “partially” covered, i.e. the “invisible” else path is not tested thus not covered. It is true that we do not distinguish “fully not cover” or “partially not cover” in our default coverage display today… it is either fully covered or not. The
index.html
does provide more useful information stating it is either “else” or the “if” path that is not covered…We could mark the partially uncovered branch with different visuals… and could possibly take it further by providing different colors for if-vs-else coverage 🤔 …