Skip to content

Coverage report which contains a completely excluded project with wrong percentage, affects the threshold requirements as well #74

@ido-namely

Description

@ido-namely

When excluding a whole project (using /Exclude flag, but I'm guessing after reviewing the code this could happen if using the label exclusion method as well for all project)

  1. the project is still showing in the report with NaN% percentage
  2. The overall percentage of the report isn't calculated correctly and/or the threshold calculations aren't not correct.

To reproduce:
dotnet test test\coverlet.core.tests\coverlet.core.tests.csproj -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude=\"../../src/coverlet.core/\"

If you had this to the build.proj before creating the nugt package it would be easier to reproduce:
<Target Name="RunTestsWithExclude" AfterTargets="RunTests"> <Exec Command="dotnet test --no-build $(MSBuildThisFileDirectory)test\coverlet.core.tests\coverlet.core.tests.csproj -c $(Configuration) /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude=\&quot;../../src/coverlet.core/,$(MSBuildThisFileDirectory)/src/coverlet.core/Reporters/**/*.cs\&quot;"/> </Target>

The output:

Module Coverage
coverlet.core NaN%

Expected output:

Module Coverage
coverlet.core 0%

or

Module Coverage

Also the project should not be accounted for as part of the overall threshold calculations (in case there are other projects which are included)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions