Add separate step to generate coverage reports

This commit is contained in:
JoannaaKL
2023-05-19 10:58:18 +00:00
committed by GitHub
parent 49b04976f4
commit 1fc63f4aaa
2 changed files with 11 additions and 0 deletions

View File

@@ -15,6 +15,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />

View File

@@ -203,6 +203,12 @@ function runtest ()
dotnet msbuild -t:test -p:PackageRuntime="${RUNTIME_ID}" -p:BUILDCONFIG="${BUILD_CONFIG}" -p:RunnerVersion="${RUNNER_VERSION}" ./dir.proj || failed "failed tests"
}
function coverage ()
{
heading "Coverage ..."
cd Test && dotnet test --collect:"XPlat Code Coverage"
}
function format()
{
heading "Formatting..."
@@ -369,6 +375,7 @@ case $DEV_CMD in
"p") package;;
"format") format;;
"f") format;;
"c") coverage;;
*) echo "Invalid cmd. Use build(b), test(t), layout(l), package(p), or format(f)";;
esac