Skip to content

Commit

Permalink
Add code coverage (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
lecaillon authored Jun 8, 2019
1 parent d59ecc4 commit 4ef1cf4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#tool nuget:?package=ReportGenerator&version=4.1.10

///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -53,6 +55,20 @@ Task("test").Does(() =>
{
Configuration = configuration,
ArgumentCustomization = args => args.Append(logger)
.Append("/p:AltCover=true")
.Append("/p:AltCoverForce=true")
.Append("/p:AltCoverCallContext=[Fact]|[Theory]")
.Append("/p:AltCoverAssemblyFilter=Cassette.Tests|AspNetCore.HttpClientFactory.QuickStart|xunit.runner")
.Append($"/p:AltCoverXmlReport={publishDirFullPath}/coverage.xml")
});
});

Task("report-coverage").Does(() =>
{
ReportGenerator($"{publishDir}/coverage.xml", $"{publishDir}/coverage", new ReportGeneratorSettings
{
ReportTypes = new[] { ReportGeneratorReportType.Cobertura, ReportGeneratorReportType.HtmlInline_AzurePipelines_Dark },
Verbosity = ReportGeneratorVerbosity.Info
});
});

Expand All @@ -69,6 +85,7 @@ Task("default")
.IsDependentOn("clean")
.IsDependentOn("build")
.IsDependentOn("test")
.IsDependentOn("report-coverage")
.IsDependentOn("pack");

RunTarget(target);
2 changes: 2 additions & 0 deletions test/Cassette.Tests/Cassette.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="altcover" Version="5.3.675" />
<PackageReference Include="FluentAssertions" Version="5.6.0" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="2.2.0" />
Expand Down

0 comments on commit 4ef1cf4

Please sign in to comment.