Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>CoverNew to Visual Studio Code? Get it now.
Cover

Cover

Tom Hindle

|
2,512 installs
| (3) | Free
Display Istanbul test code coverage results in vscode. Now also displays jest coverage output.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Cover README

Features

Annotates source files with Istanbul code coverage results.

Highlights can be toggled via Ctrl-F1

Requirements

Your project must be using Istanbul and output the results to .nyc_output. Now also looks for a jest coverage output. (a 'coverage' folder) Also works with c8, as long as the json is output. (Also output to 'coverage' folder)

Normally this is just a matter of putting nyc in front of your mocha (or other test runner) call.

Using NYC/Istanbul with mocha

npm i nyc

nyc --reporter=text mocha

Using C8 with mocha

npm i c8

c8 mocha

c8 --reporter=json mocha

Do not use --reporter=text (as this suppresses needed json output.)

Using Jest

If you are using jest you can now run: jest --coverage

Adding the following to your jest.config.js config will make jest create coverage reports for source files that lack any tests.

collectCoverage: true, // Enable coverage collection collectCoverageFrom: [ "src//*.{js,jsx,ts,tsx}", // Adjust the path according to your project structure "!src//*.d.ts" // Exclude TypeScript declaration files ]

Known Issues

Doesn't yet contain any configuration options. Currently only displays (lack of) statement coverage and doesn't show lack of branch coverage.

Release Notes

0.0.1

Initial release of Cover.

0.0.2

Allow toggling highlighting via Ctrl-F1

0.0.4

Display coverage in all open copies of a files, rather than just the first one.

0.0.6

Add support for jest test coverage output. (jest --coverage)

Note: Will now look for a '.nyc_output' folder first in project root dir, and if not found will then look for folder named 'coverage'.

0.0.7

Minor bug fix, and readme update, to document c8 support.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft