feat: Support excluding source paths from coverage reporting#1809
Merged
chagong merged 9 commits intomicrosoft:mainfrom Feb 10, 2026
Merged
feat: Support excluding source paths from coverage reporting#1809chagong merged 9 commits intomicrosoft:mainfrom
chagong merged 9 commits intomicrosoft:mainfrom
Conversation
Sometimes simplicity is best.
Contributor
Author
|
@microsoft-github-policy-service agree |
Helen-con
approved these changes
Nov 12, 2025
Copilot AI
added a commit
that referenced
this pull request
Feb 10, 2026
Co-authored-by: chagong <831821+chagong@users.noreply.github.com>
Copilot AI
added a commit
that referenced
this pull request
Feb 10, 2026
Implements PR #1809 with fixes: - Add minimatch as direct dependency (was only transitive before) - Fix typo in description ('The can' -> 'They can') - Use correct @SInCE version (0.44.0 matching current package version) - Remove unnecessary eslint-disable comment and debug question - Cleaner filtering logic using Array.filter Co-authored-by: chagong <831821+chagong@users.noreply.github.com>
chagong
approved these changes
Feb 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Sometimes the coverage reporting will report on source files that really shouldn't be in the coverage report, giving wildly skewed results. See #1749 for an example of somebody reporting this issue or see the following screenshot where I ran into this today while working on a Minecraft modding project (the coverage reporter is reporting on the Minecraft source code in addition to my own).
Solution
Add a new configuration option:
java.test.config.coverage.excludes. This option supports any "globbing" pattern supported by minimatch internally since it's used for the pattern matching support. Run the list of files returned by the coverage provider through this pattern matcher set. Only provide coverage results from the total set that aren't excluded by the patterns.Empty lists will still return all coverage results, see the below screenshot.
See the below screenshots for examples of working patterns.
Filtering the entire build directory.
Filtering only one path out of several.
Multiple path filters.