Skip to content

Commit

Permalink
Fix dotnet test when not generating code coverage reports (#80)
Browse files Browse the repository at this point in the history
#79 added code coverage reports, but broke a basic `dotnet test`. In
that case no Cobertura reports are generated and thus the
`<ReportGenerator>` task fails.

Fix to condition running the report generator on having reports to
process.
  • Loading branch information
MattKotsenas authored Jun 11, 2024
1 parent 5212cbe commit 0a7f49a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion build/targets/tests/Tests.targets
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
<ItemGroup>
<_CoverageFiles Include="$(_TestCoverageGlob)" />
</ItemGroup>
<ReportGenerator ProjectDirectory="$(MSBuildProjectDirectory)" ReportFiles="@(_CoverageFiles)" TargetDirectory="$(_TestCoverageReportDirectory)" ReportTypes="MarkdownSummaryGithub;Cobertura;HtmlInline" />
<ReportGenerator
Condition=" '@(_CoverageFiles)' != '' "
ProjectDirectory="$(MSBuildProjectDirectory)"
ReportFiles="@(_CoverageFiles)"
TargetDirectory="$(_TestCoverageReportDirectory)"
ReportTypes="MarkdownSummaryGithub;Cobertura;HtmlInline" />
</Target>
</Project>

0 comments on commit 0a7f49a

Please sign in to comment.