Skip to content

Code coverage threshold does not fail if no coverage generated #1083

@martincostello

Description

@martincostello

If coverlet.msbuild is configured with a Threshold value for a minimum code coverage required by tests, but then no coverage is output for coverlet for some reason, then rather than fail the build, it instead passes because the total coverage is given as 100%.

+--------+------+--------+--------+
| Module | Line | Branch | Method |
+--------+------+--------+--------+

+---------+------+--------+--------+
|         | Line | Branch | Method |
+---------+------+--------+--------+
| Total   | 100% | 100%   | 100%   |
+---------+------+--------+--------+
| Average | NaN% | NaN%   | NaN%   |
+---------+------+--------+--------+

You can also see the average is reported as NaN%.

See reactiveui/refit#1073 for a scenario where this behaviour masked an issue with code coverage generation because tests still passed.

Coverlet should fail the build and draw the developer's attention to the issue, rather than give a false impression that code coverage is being maintained above previous thresholds configured by the repository.

Metadata

Metadata

Assignees

Labels

Priority:0Critical to the releasebugSomething isn't workingdriver-consoleIssue related to dotnet net tool driverdriver-msbuildIssue related to msbuild driveruntriagedTo be investigated

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions