Skip to content
| Marketplace
Sign in
Visual Studio Code>Testing>PR Code CoverageNew to Visual Studio Code? Get it now.
PR Code Coverage

PR Code Coverage

shivi-devtools

|
4 installs
| (0) | Free
Shows code coverage for only the files and lines changed in a pull request (Azure DevOps / GitHub / local git).
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

PR Code Coverage

A 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

  • Git (on PATH)
  • .NET SDK (the dotnet command)
  • Azure CLI with the azure-devops extension, signed in with az login (used to detect the PR for your branch)

Install

Install from the Visual Studio Marketplace:

  1. Open the Extensions panel in VS Code (Ctrl+Shift+X).
  2. Search for PR Code Coverage.
  3. Click Install.

Or from a terminal:

code --install-extension shivi-devtools.pr-code-coverage

Marketplace page: https://marketplace.visualstudio.com/items?itemName=shivi-devtools.pr-code-coverage

After installing, reload VS Code if prompted (Developer: Reload Window).

Updating

Marketplace installs update automatically when a new version is published. No manual steps needed.

How to use

  1. Open your repo as the workspace folder.
  2. Click the PR Coverage icon in the Activity Bar on the left.
  3. Click "Run Unit Tests + Analyze" in the panel toolbar.

What happens:

  • It detects the PR for your current branch and uses the PR target branch as the base.
  • It fetches the latest base branch so you compare against the newest develop.
  • It auto-detects the unit test project from the pipeline so it does not run integration tests.
  • It runs the unit tests with coverage, then shows coverage for only your changed lines.

Results show as a folder tree. 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 shows the overall percent and the change since your last run.

Coverage View (green and red highlights)

Click a file in the results tree to open a read-only Coverage View beside your code. It shows the same file with your changed lines highlighted:

  • Green lines are covered by tests.
  • Red lines are not covered.

The view is read-only and opens in a separate column, so your editing window stays clean and you are never blocked from coding. 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 prCoverage.showDecorations.

If you already have a coverage report and do not want to re-run tests, click "Analyze Changed Files" instead.

Settings

Open Settings and search for "PR Coverage".

  • prCoverage.baseBranch: fallback base when no PR is found (default origin/main)
  • prCoverage.autoFetchBase: fetch the base branch before diffing (default on)
  • prCoverage.testProject: a specific unit test project to run, leave empty to auto-detect
  • prCoverage.coverageEngine: xplat (fast, default) or vs-codecoverage (matches CI engine)
  • prCoverage.coverageReportGlob: how coverage reports are found
  • prCoverage.showDecorations: also highlight covered and uncovered lines inline in the editable file (default off; the Coverage View shows them instead)
  • prCoverage.showTestTotal: enumerate tests first so progress shows a live X/total count (default on)
  • prCoverage.killStaleTestHosts: kill orphaned test host processes before a run so they do not lock test DLLs (default on)

Notes

  • The percent is a local measure. It can read slightly different from the Azure DevOps PR check because the CI tool counts coverable lines differently. Any line shown red here is genuinely untested, so covering everything red will pass the CI gate.
  • The extension always compares your latest local code against the latest base branch, so you can see your coverage go up as you add tests.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft