Skip to content

Conversation

@glektarssza
Copy link

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).

original-problem

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.

empty-new-config

See the below screenshots for examples of working patterns.

Filtering the entire build directory.

filled-config-solution

Filtering only one path out of several.

partial-exclude

Multiple path filters.

multiple-filters

@glektarssza
Copy link
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant