jest-community / vscode-jest

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

Unable to see/update Coverage with auto-run off #855

Closed 11joselu closed 2 years ago

11joselu commented 2 years ago

Environment

  1. vscode-jest version: v4.4.0
  2. node -v: v16.1.0
  3. npm -v or yarn --version: 7.11.2
  4. npm ls jest or npm ls react-scripts (if you haven’t ejected): jest@27.5.1
  5. your vscode-jest settings if customized:
    "jest.coverageFormatter": "GutterFormatter",
    "jest.autoRun": "off",
    "jest.coverageColors": { "uncovered": "rgba(255,99,71, 0.2)", "partially-covered": "rgba(255,215,0, 0.2)"}
  6. Operating system: Linux mint 20.2

Prerequisite

Steps to Reproduce

You can reproduce using this repo: https://github.com/CodiumTeam/legacy-training-js/tree/master/tennis-refactoring-kata

Relevant Debug Info

Expected Behavior

After runing all tests and clicking in 'Toggle coverage" we should be able to see the coverage report as a Gutter.

Actual Behavior

Disabling autoRun, if you run all test then "Toggle coverage" the reports do not appears. You need to click in the coverage icon (bottom line) and then focus in code. After that, the coverage appears. Even if you remove some tests cases, run all tests + toggle coverage, did not refresh the report

Example

Sometimes I use shortcut to toggle coverage (window + space) vs-code-coverage


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...

connectdotz commented 2 years ago

After runing all tests and clicking in 'Toggle coverage" we should be able to see the coverage report as a Gutter.

Not quite. To see the coverage report, you need to tell jest to generate the coverage info, therefore the right sequence will be

  1. toggle coverage on
  2. run tests

I tried your repo and it seems to work as expected.

11joselu commented 2 years ago

Yes, I do and it seems to work too. I will close it. Thanks for your time :)