Update documentation for excluding source files from code coverage
See original GitHub issueI have problems with excluding source files from code coverage.
Here is my file structure: App.UnitTests – runsettings.xml, <other irrelavant files> App – obj, < project files >
I want to exclude from code coverage the obj
folder which is located inside the App
folder. So I have navigated in the terminal to App.UnitTests
folder and executed this command:
dotnet test --collect:"XPlat Code Coverage" --settings runsettings.xml
Here is my runsettings.xml
file.
<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="XPlat code coverage">
<Configuration>
<Format>cobertura</Format>
<ExcludeByFile>../obj/**/*,</ExcludeByFile>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
Unfortunately this is not working. The code coverage is including files in obj
folder. Why is this happening? I will be glad for any help.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Customizing Code Coverage Analysis - Visual Studio
You can include or exclude assemblies or specific types and members from code coverage analysis. If the Include section is empty or omitted, ......
Read more >python - coverage.py: exclude files
According to the documentation you can exclude code by matching lines. I want to exclude entire files, so that the reports don't include...
Read more >Excluding Files and Folders
To exclude files from test coverage reporting, you'll need to exclude them via your local test coverage suite. Pattern Format. Each entry in...
Read more >How to Use a File to Exclude Files From Code Coverage
How to Use a File to Exclude Files From Code Coverage · You can set coverage exclusions in the SonarCloud UI. · You...
Read more >Excluding files from code coverage in GO
First things first, a quick recap. Code coverage can be generated using the go cover tool. From the docs, usage of the tool...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@MarcoRossignoli Ok. Thanks for the response. Yeah, the docs need to be updated because they are very misleading, i.e. here:
https://github.com/tonerdo/coverlet/blob/master/Documentation/VSTestIntegration.md https://github.com/tonerdo/coverlet/blob/master/Documentation/MSBuildIntegration.md#excluding-from-coverage
And the docs even explicitly says:
So since the relative path is not working, right now I am using this filter:
This filter excludes all files in the
obj
folder from code coverage.I’ll keep this open until doc fix. There was a bug in first implementation, we fixed code but not documentation 🤔