我们在.net5中有一个api,我们使用coverlet.msbuild来验证我们的代码覆盖率,但是我们的解决方案有50个csprojs,我们遇到了一个错误,一些项目返回0%的覆盖率,所以我们将包更改为coverlet.collector,我们现在的问题是coverlet.collector不支持阈值验证。
最后,我们有一个cobertura格式的xml文件,我们只想运行一个命令,看看报告的代码覆盖是否正常,并让PR继续其过程。
发布于 2022-05-23 21:13:32
我也面临过这个问题。解决办法是直接使用被子。您可以将其安装为dotnet的全局工具。注意,在没有标志--no-build的情况下,我无法正确地收集覆盖率。我的工作命令是:
"C:\Program Files\dotnet\dotnet.exe" C:\Users\dalec\.nuget\packages\coverlet.console\3.1.2\tools\net5.0\any\coverlet.console.dll \
C:\Users\dalec\source\repos\ZTR.AI\ZTR.AI.Common\ZTR.AI.Common.Core.Tests\bin\Debug\net5.0\ZTR.AI.Common.Core.Tests.dll \
--target "C:\Program Files\dotnet\dotnet.exe" \
--targetargs "test C:\Users\dalec\source\repos\ZTR.AI\ZTR.AI.Common\ZTR.AI.Common.Core.Tests\ZTR.AI.Common.Core.Tests.csproj \
--configuration Debug --no-build" --output C:\Users\dalec\source\repos\ZTR.AI\testrestults\ZTR.AI.Common.Core.Tests/ \
--format cobertura --format json --threshold 69不幸的是,我仍然不能收集Ubuntu的报道。
https://stackoverflow.com/questions/68292034
复制相似问题