-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dotnet test --collect:"code coverage" includes 3rd party dlls #1917
Comments
I discovered the .runsettings file. At the solution level, I created a codecoverage.runsettings file. I then run this command: This appears to give me what I need. Here are my runsettings. Hopefully I'm not leaving out anything important.
|
@GoFightNguyen Currently we do instrument all dependent dlls (whether they come from 3rd part dependency or nuget reference). However this package can be excluded from |
Exclusion by .runsettings file is a bit painful. Exclude 3rd party and Tests assemblies it would be nice. |
Agree 99% of the time no one would want to include nuget packages or test assesmblies, this should be default behaviour. |
I agree 100% the default behavior should not include extra DLLs. Futhermore, filtering by .runsettings file is not working for both "dotnet test" and "dotnet-coverage". This should be reopened and the default behavior should be changed. Alternatively, an easy switch should be added to remove 3rd party imported NuGets/DLLs etc. |
This should be reopened as a feature request, I can't fathom reasons the default behavior should be to include assemblies we have 0 control over |
This is not working as designed, because the runsettings does not exclude extra DLLs even when explicitly told to do so. (Nor does this make any sense to have this as the default behavior.) |
Please reopen this as other already mentioned, it makes no sense to include the coverage for the source files we have no control over i.e the 3rd party packages |
@fhnaseer is there anything that can be done to exclude 3-rd party dlls automatically or to help in this area? |
You can try to restrict symbols search paths to skip third party dependencies. You can try the following options in the runsettings file.
Docs: https://github.com/microsoft/codecoverage/blob/main/docs/configuration.md |
Description
.NET Core 2.1
MSTest.TestAdapter v1.4.0
MSTest.TestFramework v.1.4.0
Microsoft.NET.Test.Sdk v 15.9.0
Steps to reproduce
Create a .NET Core Test project with a test
Add a dependency to the FluentAssertions NuGet pkg
dotnet test --blame --collect:"Code Coverage"
Open the coverage file
Expected behavior
I would not see coverage details for FluentAssertions
Actual behavior
I see coverage details for FluentAssertions
The text was updated successfully, but these errors were encountered: