PR Code CoverageA VS Code extension that shows unit test coverage for only the files and lines you changed in your branch or PR. It does not report whole codebase coverage. It answers one question: how well are the lines I changed covered, and did my new tests move the number, all locally before you push. What you need first
InstallInstall from the Visual Studio Marketplace:
Or from a terminal:
Marketplace page: https://marketplace.visualstudio.com/items?itemName=shivi-devtools.pr-code-coverage After installing, reload VS Code if prompted (Developer: Reload Window). UpdatingMarketplace installs update automatically when a new version is published. No manual steps needed. How to use
What happens:
During a long test run, the panel advances from detailed test-result output. If a test host stops reporting completed tests, it keeps showing an elapsed-time heartbeat so the current count is not mistaken for a finished run. Results show as a folder tree. The top of the panel clearly shows the overall changed-line percentage and whether the configurable coverage gate is complete. Every file changed in the PR/branch diff (against the latest base branch) is shown, whether or not it has coverage data. Use the eye button to show only files that have coverage data. Each file shows covered over coverable changed lines and a percent. Open a file to see green (covered) and red (uncovered) highlights on your changed lines. The status bar uses a pass or error icon to show the gate state and shows the change since your last run. When coverage is below the gate, click the Copilot button in the panel toolbar (Generate Unit Tests with Copilot). It opens Copilot Chat with a concise list of the highest-priority uncovered files and line ranges, so the chat can inspect the local workspace without receiving a large copied source dump. Coverage View (green and red highlights)Click a file in the results tree to open a read-only Coverage View in the active editor. It shows the same file with your changed lines highlighted:
The view is read-only and opens as a preview tab in the active editor group, so clicking another file reuses the same tab instead of piling up new ones. It jumps to the first uncovered line and marks the overview ruler so you can scan the whole file at a glance. Re-run the analysis to refresh it. If you also want the highlights inline in the editable file, turn on If you already have a coverage report and do not want to re-run tests, click "Analyze Changed Files" instead. SettingsOpen Settings and search for "PR Coverage".
Notes
|