vscode-jest icon indicating copy to clipboard operation
vscode-jest copied to clipboard

Not getting coverage overlay to work

Open ScottChapman opened this issue 4 years ago • 3 comments

Environment

  1. node -v: 12.16.0

  2. npm -v: 6.14.9

  3. npm ls jest or npm ls react-scripts (if you haven’t ejected): 26.6.3

  4. your vscode-jest settings if customized:

    • jest.pathToJest? [fill]
    • jest.pathToConfig? [fill]
    • anything else that you think might be relevant? - using defaultFormatter (gutter formatter doesn't change results)
  5. Operating system: MacOS

Prerequisite

  • are you able to run jest test from command line? yes
  • how do you run your tests from command line? (for example: npm run test or node_modules/.bin/jest) run test

Steps to Reproduce

Toggle overlay (icon in status bar shows it is on). I can see coverage stats at top of file

Relevant Debug Info

Expected Behavior

highlight test with code that is covered and code that is not

Actual Behavior

None.


The fastest (and the most fun) way to resolve the issue is to submit a pull-request yourself. If you are interested, feel free to check out the contribution guide, we look forward to seeing your PR...

ScottChapman avatar Apr 30 '21 13:04 ScottChapman

if you are using the default coverage fomatter, the covered lines will not be marked, only the uncovered lines will be highlighted. What do the stats on top of the file show?

connectdotz avatar Apr 30 '21 16:04 connectdotz

yea, I even introduced some new lines that weren't being covered because I knew that's how it worked. The status on the top was saying there were uncovered lines, just no highlighting.

After restarting the environment and Jest a couple of times it seems like it eventually worked, but I'm not clear what made it do so. Is coverage determined from a run outside of the extension then just shown?

ScottChapman avatar Apr 30 '21 17:04 ScottChapman

Is coverage determined from a run outside of the extension then just shown

the extension spawns a jest process with coverage then parses the result and displays. If the stats above showed uncovered stats then it probably generated/parsed the coverage report all right but just not showing it correctly. Can you try v4.0.0-alpha.5, the latest release candidate, as we fixed a few bugs related to formatters, it might have already been fixed.

connectdotz avatar Apr 30 '21 18:04 connectdotz