Skip to content

Coverlet ThresholdType mulitple Value Note Working #1143

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

Closed
huangydyn opened this issue Apr 12, 2021 · 4 comments
Closed

Coverlet ThresholdType mulitple Value Note Working #1143

huangydyn opened this issue Apr 12, 2021 · 4 comments
Assignees
Labels
waiting for customer Waiting for customer action

Comments

@huangydyn
Copy link

Enviroment

  • Mac Zsh
  • coverlet.msbuild 3.0.3
  • MsBuild

Issue

I want to set threhold for different thresholdtype

dotnet test /p:CollectCoverage=true /p:Threshold="10,10,8"  /p:ThresholdType="line,branch,method"

then return

MSBUILD : error MSB1006
@daveMueller daveMueller added the untriaged To be investigated label Apr 16, 2021
@daveMueller
Copy link
Collaborator

Seems like a bug. Thanks for reporting, I'll take a look.

@daveMueller daveMueller self-assigned this Apr 16, 2021
@daveMueller
Copy link
Collaborator

The feature for multiple thresholds isn't available in version 3.0.3 yet. It will be in the next release (#1123 (comment)).

Up to that point you can consume the nightly (https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/ConsumeNightlyBuild.md).

Also you have to take into a account that you can't pass property values containing a semicolon or comma to msbuild. One way to work around this is to escape the quotes (dotnet/msbuild#471), e.g.

dotnet test /p:CollectCoverage=true /p:Threshold=\"10,10,8\" /p:ThresholdType=\"line,branch,method\"

I will update the documentation for this.

@daveMueller daveMueller removed the untriaged To be investigated label Apr 16, 2021
@daveMueller daveMueller added the waiting for customer Waiting for customer action label Apr 16, 2021
@MarcoRossignoli
Copy link
Collaborator

closed in #1143

@Ogglas
Copy link

Ogglas commented Mar 16, 2022

The feature for multiple thresholds isn't available in version 3.0.3 yet. It will be in the next release (#1123 (comment)).

Up to that point you can consume the nightly (https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/ConsumeNightlyBuild.md).

Also you have to take into a account that you can't pass property values containing a semicolon or comma to msbuild. One way to work around this is to escape the quotes (dotnet/msbuild#471), e.g.

dotnet test /p:CollectCoverage=true /p:Threshold=\"10,10,8\" /p:ThresholdType=\"line,branch,method\"

I will update the documentation for this.

This failed for me using Powershell.

MSBUILD : error MSB1006: Property is not valid.
Switch: 92

What worked for me though was using MSBuild escaping. Comma is %2c

Complete example:

dotnet test C:\Users\oscar\source\repos\project\Repository.sln --configuration Release /p:CollectCoverage=true /p:Include="[*]Repository.Web.Controllers.*" /p:Threshold="100%2c90%2c80" /p:ThresholdType="method%2cline%2cbranch"

dotnet/msbuild#2999 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for customer Waiting for customer action
Projects
None yet
Development

No branches or pull requests

4 participants