Visualizing Coverage with Coverage Gutters in agoric-sdk #11659
dckc
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Want to see which lines your tests actually hit without leaving VS Code? With
c8 --reporter=lcov
and the Coverage Gutters extension, you get instant visual feedback in the editor—green for covered, red for missed. Unlike the HTML reporter, there's no context switch: just run your tests, load coverage, and keep coding.Setup
If you're already running coverage via
yarn test:c8
, you're 90% there. Just make sure it includes--reporter=lcov
(you can pass it via env var like this:C8_OPTIONS="--reporter=lcov" yarn test:c8
). That should producecoverage/lcov.info
.Next, install the Coverage Gutters extension: Coverage Gutters on Marketplace
Then in VS Code, open the command palette (
Cmd/Ctrl+Shift+P
) and run:You’ll see green and red marks in the gutter indicating which lines are covered. No HTML viewer, no scrolling through a browser. Just glance and go.
Want it to reload automatically? You can add this to
.vscode/settings.json
:That’s it—you’re now visualizing coverage inline with your code.
Limitations
Performance: Running
Coverage Gutters: Display Coverage
can take 10–15 seconds even on smaller packages likepackages/portfolio-contract
. It's parsinglcov.info
and matching paths across your workspace. This is normal, but noticeable—especially if you’re expecting instant feedback.Branch coverage visibility: While
c8
collects full branch coverage, Coverage Gutters only shows line-level indicators. If any part of a line is covered, it appears green—even if only one branch of anif/else
was exercised. For detailed branch info, use the HTML report or inspectlcov.info
directly.References
c8
coverage toolBeta Was this translation helpful? Give feedback.
All reactions