I have a build pipeline in Azure DevOps for a ASP.NET Core app, and a want use it with a criteria to approve a pull requests.
steps:
- script: dotnet restore
displayName: 'Run command: dotnet restore'
- script: >
dotnet test
/p:CollectCoverage=true
/p:CoverletOutputFormat=cobertura
/p:Threshold=80
/p:ThresholdStat=total
/p:Exclude="[*xunit.*]*"
displayName: 'Run command: dotnet test'
I want when code coverage (using coverlet) don't pass, the build fails. but despite the acceptance criteria do not pass, even a log message is generated, the step runs successfully.
coverlet.msbuild.targets(41,5): error : The total line coverage is below the specified 80 coverlet.msbuild.targets(41,5): error : The total branch coverage is below the specified 80 coverlet.msbuild.targets(41,5): error : The total method coverage is below the specified 80
It's possible force a fail in this case?
failOnStderr: true
in the dotent test task – Shayki Abramczyk