File Coverage Insight
Line, branch, function and statement coverage for the file you are looking at — in the status bar, on hover, and in the gutter.

File Coverage Insight reads the coverage reports your test runner already produces and maps them onto the file that is open in the editor. No wrappers, no watchers, no test runner plugins — if coverage/lcov.info or coverage/coverage-final.json exists, you get coverage immediately after installing.
Works with Jest, Vitest, Karma/Angular, Jasmine, Mocha (via Istanbul/nyc/c8) and any tool that can emit LCOV, Istanbul JSON, Jest JSON summary, V8 or HTML coverage.
Contents
Highlights
- Per-file metrics in the status bar — lines, functions, branches or statements, whichever you prefer, colour-coded against your own thresholds, with the detected framework beside it.
- Hover any line to see whether it is covered, how many times it ran, and a summary table of all four metrics for the file.
- Helpful when a file has no coverage yet: the hover and the status bar tell you which command generates the report for your framework, and where the extension looked.
- Gutter highlighting of uncovered lines and of covered-but-barely-executed lines, so dead or untested branches stand out while you read the code.
- Framework auto-detection for Jest, Vitest, Karma, Jasmine and Mocha, plus Angular/React/Vue/Node project detection.
- Multi-format, multi-report merging — Jest's
coverage-summary.json, Istanbul's coverage-final.json, LCOV and V8 reports are combined, and the report carrying real line data always wins.
- Works in monorepos — coverage reports are searched per workspace folder.
- TypeScript-first, strictly typed, with a 199-test suite (14 suites), an activation smoke test, and lint/format enforced by Biome.
- Error and failure logs kept separately from the output channel, with a panel to review them, an email action, and a full report export.
- Privacy-respecting — everything is processed locally; anonymous telemetry is opt-in and stays on your machine.
Supported coverage reports
| Report |
Typical producer |
Lines |
Statements |
Functions |
Branches |
coverage/coverage-final.json |
Jest, nyc, c8, Istanbul |
✅ |
✅ |
✅ |
✅ |
coverage/lcov.info |
Jest, Angular/Karma, Vitest, c8, nyc |
✅ |
~ as lines |
✅ |
✅ |
coverage/coverage-summary.json |
Jest json-summary, Angular |
% only |
% only |
% only |
% only |
coverage/v8-final.json |
Node's built-in V8 coverage |
estimated |
estimated |
✅ |
— |
HTML reports with embedded window.__coverage__ |
Istanbul html reporter |
best effort |
best effort |
best effort |
best effort |
Only coverage-final.json and lcov.info carry per-line data. Coverage percentages show up for all formats, but hover details and gutter highlighting need one of those two. See docs/COVERAGE-FORMATS.md for the exact parsing rules.
Supported files are those VS Code reports as TypeScript or JavaScript — .ts, .tsx, .mts, .cts, .js, .jsx, .mjs, .cjs — as long as they live inside your workspace. The tab-bar and right-click actions appear for .ts, .tsx, .js and .jsx. Test files, .d.ts declarations and node_modules are skipped on purpose.
Install
From the Marketplace — search for File Coverage Insight in the Extensions view, or:
code --install-extension RajatMalik.file-coverage-insight
From a VSIX build:
npm run package
code --install-extension file-coverage-insight-1.1.0.vsix
Requirements: VS Code 1.74 or newer. Nothing else — no test runner dependency, no configuration file required.
Quick start
Generate coverage once with your test runner:
npx jest --coverage # Jest
npx vitest run --coverage # Vitest
ng test --code-coverage --watch=false # Angular / Karma
npx c8 npm test # c8 / nyc / Mocha / Jasmine
Open any source file from that project in VS Code.
Look at the bottom-right status bar — coverage for that file appears instantly. Hover a line for detail.
Coverage files are read from disk, so the extension stays fast: no test process is started unless you explicitly ask for it (see fileCoverage.enableFileCoverage).
What you will see
Status bar (bottom right) Hover on any line
[ check ] 82% (Jest) ### Line Coverage
click to refresh Line 12: Covered - ran 7 times
Editor title (tab bar) | Metric | Coverage | Status |
[ 82% ] [refresh] [actions] | Lines | 42/51 (82%) | green |
| Functions | 14/19 (74%) | orange |
Gutter (fileCoverage. | Branches | 12/16 (75%) | orange |
gutterDecorations: true) | Statements | 42/51 (82%) | green |
line 41 red = never executed
line 42 orange = covered, but fewer than 3 runs
The status bar item shows your preferred metric, is colour-coded by your thresholds, and its tooltip lists every metric together with the detected framework, project type and detection confidence. Clicking it refreshes coverage.
Screenshots
Install from the Extensions view


Open the error and failure log panel

Email the recorded logs
Email Logs opens your default mail client with the report pre-filled and addressed to the maintainer.

Export the full report
Export Logs saves the complete report as a .log file that you can attach to an email or a GitHub issue.

Reach the log actions from the coverage quick pick

Commands and keybindings
| Command (Command Palette) |
Keybinding |
What it does |
File Coverage: Refresh Coverage |
Ctrl+Alt+C / Cmd+Alt+C |
Re-read the coverage reports and update the editor |
File Coverage: Show Coverage Actions |
Ctrl+Alt+Shift+C |
Quick pick: run tests, open the HTML report, open settings, toggle gutters |
File Coverage: Toggle Coverage Display |
— |
Show/hide the status bar item |
File Coverage: Run Tests with Coverage |
— |
Runs your configured command in a terminal, then refreshes |
File Coverage: Show Framework Detection Info |
— |
Explains why a framework was detected, with confidence |
File Coverage: Show Telemetry Information |
— |
Shows what (if anything) is collected locally |
File Coverage: Email Error Logs |
— |
Opens your email client with the recorded error/failure logs |
File Coverage: Show Error Logs |
— |
Opens a panel listing every recorded error and failure |
File Coverage: Export Error Logs |
— |
Saves the full error log report to a file |
File Coverage: Clear Error Logs |
— |
Clears the captured error logs and the File Coverage output channel |
File Coverage: Why Is Coverage Missing? is what opens when you click a status bar item that reads "No Coverage": it names the command for the detected framework, lists the report paths that were searched, and offers buttons to run tests, refresh, open settings or open the log.
Error and failure events are recorded separately from the normal output channel, so they are not lost among info/debug messages. Use Show Error Logs to review them, Export Error Logs to save a report, Email Error Logs to send the report to the maintainer, or Clear Error Logs to remove them. These actions are also available from the coverage quick pick and as two buttons in the editor tab bar.
Refresh, Show Coverage Actions, Email Error Logs and Show Error Logs are also available in the editor tab bar for .ts, .tsx, .js and .jsx files; Refresh and Show Coverage Actions are in the editor right-click menu too.
Settings
All settings live under fileCoverage. and are described in the Settings UI (Ctrl+, → search "File Coverage").
| Setting |
Type |
Default |
Description |
fileCoverage.coverageFiles |
array |
["coverage/coverage-final.json", "coverage/coverage-summary.json", "coverage/lcov.info", "coverage/v8-final.json"] |
Report files to read, relative to each workspace folder. Globs are supported. |
fileCoverage.preferredMetric |
enum |
"lines" |
Which metric the status bar shows: lines, functions, branches or statements. |
fileCoverage.thresholds |
object |
{"red": 50, "yellow": 80} |
Colour cut-offs. Below red is red, below yellow is orange, otherwise green. |
fileCoverage.refreshOnSave |
boolean |
true |
Re-read the reports when you save a file. |
fileCoverage.showInStatusBar |
boolean |
true |
Show coverage in the status bar. |
fileCoverage.runTestsCommand |
string |
"" |
Custom command to run tests with coverage. Use ${file} for the workspace-relative path of the current file. |
fileCoverage.enableFileCoverage |
boolean |
false |
Master switch for running tests automatically. When off, only stored reports are read. |
fileCoverage.coverageOnFileOpen |
boolean |
true |
Update the display when a file is opened (runs tests if enableFileCoverage is on). |
fileCoverage.coverageOnFileChange |
boolean |
true |
Update the display while editing, debounced (runs tests if enableFileCoverage is on). |
fileCoverage.excludePatterns |
array |
["**/*.d.ts", "**/node_modules/**", "**/*.test.*", "**/*.spec.*"] |
Files that are never processed. |
fileCoverage.disableRealTimeForAngular |
boolean |
true |
Never run per-file tests in Angular projects (Karma runs whole suites). |
fileCoverage.gutterDecorations |
boolean |
false |
Highlight uncovered lines in the gutter and overview ruler. |
fileCoverage.autoDetectFramework |
boolean |
true |
Detect Jest/Vitest/Karma/Jasmine/Mocha automatically. |
fileCoverage.telemetryEnabled |
boolean |
false |
Opt in to anonymous, local-only usage counters. |
fileCoverage.logLevel |
enum |
"info" |
Output channel verbosity: error, warn, info, debug. |
Example .vscode/settings.json:
{
"fileCoverage.preferredMetric": "branches",
"fileCoverage.thresholds": { "red": 60, "yellow": 85 },
"fileCoverage.gutterDecorations": true,
"fileCoverage.coverageFiles": [
"coverage/coverage-final.json",
"coverage/lcov.info",
"packages/*/coverage/lcov.info"
]
}
Framework setup
Jest (React, Node, Next.js)
npx jest --coverage
Jest writes coverage/lcov.info and coverage/coverage-final.json with its default reporters, so everything — percentages, hover detail and gutters — works out of the box. Create React App users can run npm test -- --coverage --watchAll=false.
Vitest
npx vitest run --coverage
@vitest/coverage-v8 and @vitest/coverage-istanbul both emit reports this extension understands. If you use the V8 provider and want per-line detail, set the lcov reporter in vitest.config.ts:
test: {
coverage: {
reporter: ['text', 'lcov', 'json-summary'];
}
}
Angular and Karma
ng test --code-coverage --watch=false
Angular projects are handled read-only: the extension reads the report Angular already generated rather than trying to launch Karma for one component. coverage/lcov.info gives you percentages and line detail, so hover and gutters work. To also get coverage-final.json, add json to coverageReporters in angular.json.
c8, nyc, Mocha, Jasmine
npx c8 npm test
npx nyc mocha
Both wrap the runner and produce an Istanbul-style coverage/coverage-final.json (c8) or LCOV/json-summary (nyc via reporters), which is picked up automatically.
Monorepos
Point fileCoverage.coverageFiles at each package's report, or use a glob:
{ "fileCoverage.coverageFiles": ["packages/*/coverage/lcov.info"] }
Every workspace folder is scanned, and reports that describe the same file are merged with per-line data taking priority.
How coverage is matched to your file
Different tools write wildly different path styles for the same file: Jest writes absolute paths, LCOV writes project-relative paths, V8 writes file:/// URLs. File Coverage Insight normalises all of them and resolves the open file in this order:
- exact match after canonicalisation,
- case-insensitive match,
- path-suffix match (absolute path vs. project-relative path),
- same file name as a last resort.
When more than one report describes the same file, the entry that carries per-line data is kept. That is why a project with both coverage-summary.json and lcov.info still gets full line detail.
Implementation details, including the service responsibilities and the parsing rules per format, are documented in docs/ARCHITECTURE.md and docs/COVERAGE-FORMATS.md.
Troubleshooting
Coverage does not appear at all
Open the Output panel and select the File Coverage channel. The log lists every report path that was probed, whether it was parsed, and how the framework was detected. The usual causes are that no coverage report exists yet, or that the report lives outside the paths in fileCoverage.coverageFiles.
Something failed and you want to report it
Run File Coverage: Show Error Logs to see only the error/failure events, then use Email Logs to open a pre-filled email to the maintainer or Export Logs to save the full report and attach it to an issue.
It says "No Coverage"
Coverage has not been generated for this file yet. Hover the file or click the status bar item: the extension names the command to run for your detected framework (for example npx jest --coverage) and lists the report paths it searched. The most common causes are that no coverage run has happened yet, that the file is not imported by any test, or that it is excluded (.test., .spec., .d.ts, node_modules).
Percentages appear but hover and gutters are empty
Your report is aggregate-only (coverage-summary.json). Add a line-level reporter — json for Jest/Istanbul, or lcov — so coverage-final.json or lcov.info is written.
Coverage looks stale after a test run
Run File Coverage: Refresh Coverage (Ctrl+Alt+C). With refreshOnSave enabled it also refreshes whenever you save.
Coverage is wrong for a file with the same name in another folder
The report does not contain an absolute path for the file, so name matching was used. Point fileCoverage.coverageFiles at a report that contains full paths (coverage-final.json is the most precise).
Nothing happens, and the log says "Skipping file outside workspace"
The extension only annotates files inside the opened workspace folder(s). Open the project root, not a single file.
Debugging shows a stale extension
Debug builds come from npm run build:dev; press Ctrl+R in the Extension Development Host window after changing source.
FAQ
Does it run my tests?
Only if you ask it to. fileCoverage.enableFileCoverage is false by default, so opening a file just reads the reports. Set it to true (optionally with runTestsCommand) if you want the extension to execute tests for the file you are viewing.
Which metric counts as "conditional coverage"?
Branches. Set fileCoverage.preferredMetric to branches to put branch coverage in the status bar; the hover always shows all four metrics. Today this is branch totals — per-condition path detail is on the roadmap.
Does it work with Karma's watch mode?
Yes, as a reader. Karma rewrites its report on each run and the extension picks the new numbers up on refresh or save.
Does it support Java, Python or .NET?
No. Coverage formats such as JaCoCo and Cobertura are not parsed yet, and only TypeScript/JavaScript editors are annotated.
Does it slow down my editor?
Reports are parsed once and cached for 30 seconds; editor updates are debounced and gutter decorations are capped at 500 lines per file.
Does it work over Remote SSH, WSL, dev containers or Codespaces?
Yes — the extension declares extensionKind: ["workspace"], so it runs where your files are, not on the UI side.
Privacy and telemetry
All parsing and matching happens locally. The extension contains no network code and does not upload anything on its own. Error and failure logs are stored locally; they leave your machine only when you explicitly choose Email Error Logs (which opens your own email client) or Export Error Logs (which writes a file you control).
Telemetry is off by default. When you enable fileCoverage.telemetryEnabled, the extension keeps anonymous counters (activation count, parse-error count, detected frameworks) in VS Code's local extension storage, which you can inspect or clear at any time with File Coverage: Show Telemetry Information. Workspace trust is respected: the test-running features are disabled until a workspace is trusted.
Contributing
Contributions are welcome — see CONTRIBUTING.md for the development setup, the script reference, the architecture tour and how to add a new coverage format. Bug reports and feature requests belong in GitHub issues.
CI runs on main only, and releases are published only from a v* tag created on main. The triggers, and how to change them for other branches, are documented in GITHUB-ACTIONS.md.
Roadmap
- Per-condition (branch path) detail in hovers
- Cobertura and JaCoCo parsers for other ecosystems
- Coverage diff between two runs, and trend history
- Coverage badges and thresholds surfaced in the Problems panel
License
MIT © Rajat Malik. Not affiliated with Microsoft, Meta, Google, or any testing framework mentioned above; all trademarks belong to their owners.