0

Have a Github Action running tests that I'm using dotnet-coverage to collect code coverage with. It runs great and collects fine. I've now noticed that the step does not fail when the tests fail. The exit code of the test command does not seem to affect the exit code of the collect command?

run: |
  dotnet-coverage collect 'dotnet test --logger GitHubActions --configuration Release --verbosity minimal' -f xml -o 'coverage.xml'

Action Output

... All the Logging Above...
Failed!  - Failed:     1, Passed:   186, Skipped:     0, Total:   187, Duration: 26 s - /runner/_work/Some.SuperDuper.Project/test/Tests/bin/Release/net6.0/Some.SuperDuper.Project.Tests.dll (net6.0)
Code coverage results: coverage.xml.
... End of Action Output..
Montané Hamilton
  • 547
  • 1
  • 7
  • 17
  • Maybe just using the tool in a not so useful way. Moving to dotnet test --logger GitHubActions --configuration Release --verbosity minimal --collect "Code Coverage" --settings:test/Tests/local.runsettings with a format of XML produces the same coverage result and will exit if tests fail. – Montané Hamilton Sep 29 '22 at 20:09

0 Answers0