TheAngryByrd / MiniScaffold

F# Template for creating and publishing libraries targeting .NET 6.0 `net6.0` or console apps .NET 6.0 `net6.0`.
https://www.jimmybyrd.me/MiniScaffold/
MIT License
267 stars 31 forks source link

Coverage information is blocked by itself #251

Closed ImaginaryDevelopment closed 1 year ago

ImaginaryDevelopment commented 2 years ago

Is your feature request related to a problem? Please describe. When I add new code to the project and then try to build

DotnetTest               00:00:04.1182971   (Exception of type 'Fake.DotNet.MSBuildException' was thrown.)
GenerateCoverageReport   00:00:00           (skipped)
C:\Users\foo\.nuget\packages\altcover\7.6.812\build\netstandard2.0\AltCover.targets(197,5): error : Statement coverage percentage achieved is 64% below the threshold of 80%. [D:\projects\ToMEHelper\tests\ToMEHelper.Tests\ToMEHelper.Tests.fsproj]
Collect: C:\Users\foo\.nuget\packages\altcover\7.6.812\build\netstandard2.0\AltCover.targets(197,5): error : StatementFinished (Failed) 'DotNet:test' in 00:00:04.1123981

so the default path is to only generate coverage information if the test target succeeds, but the test target fails if the coverage delta is too low, so then I don't get a coverage report to show what things need coverage

Describe the solution you'd like I'd like the coverage to be generated anyhow.

Describe alternatives you've considered I can run .\build.cmd generatecoveragereport -s but I'd think the default path should be to somehow determine when the testing target fails only because of coverage amount so that the coverage report can be generated and used to determine what things need testing.

Additional context repo if it is somehow useful at https://github.com/ImaginaryDevelopment/ToMEHelper

TheAngryByrd commented 2 years ago

Ahh yeah, it should try to generate the coverage report regardless of if it failed. We would probably have to merge the targets for DotnetTest and GenerateCoverageReport and detect whether the file that AltCover outputs is there and try running the code previously in GenerateCoverageReport.