coverlet-coverage / coverlet

Cross platform code coverage for .NET
MIT License
2.93k stars 386 forks source link

[BUG] Threshold includes also not included projects #1552

Open Mateusz19021996 opened 7 months ago

Mateusz19021996 commented 7 months ago

Describe the bug In my project I run below command to run test execution with coverage and threshold. I found problem. When I execute my command , while execution in logs I can see that error occures also in projects which are not included. For example :

This is simple structure: my-project.sln tests ---> services.unitTests.csproj ---> domain.unitTests.csproj ---> repository.unitTests.csproj src ---> services.csproj ---> domain.csproj ---> repository.csproj

I run :

dotnet test /p:CollectCoverage=true /p: CoverletOutput:"../Results/Coverage/" /p:MergeWith: "../Results/Coverage/" /p:CoverletOutputFormat:"json,cobertura,opencover" /p:Threshold:80 /p:Include:"[services.csproj]*,[domain.csproj]*"

Expected behavior

Actual behavior Actually final ASCII table with results looks fine, but while execution I can see that table is generated multiple times, and under all there are errors which says that : The total line coverage is below the specified 80 [path to not included project ]

Additional context I don't undestand this behavior's. For first why we check test coverage of test project?.. and secondly I'm trying to handle this exception by regex.. so I cannot have excpetion from not included project.. Any suggestions how to handle it?

Bertk commented 7 months ago

Hi, please double check the include parameter. This does not support file names see documentation.

github-actions[bot] commented 2 months ago

This issue is stale because it has been open for 3 months with no activity.