Skip to content
A Cake Addin for Minicover, making it as easy as possible to get cross-platform code coverage on dotnet core
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
src/Cake.MiniCover
test
tools
.gitignore
.travis.yml
Cake.MiniCover.sln
LICENSE
README.md
build.cake
build.ps1
build.sh
version.txt

README.md

Cake.MiniCover

Build Status nuget

A Cake addin for MiniCover

Usage

Until lucaslorentz/minicover#31 is resolved, you need to call the SetMiniCoverToolsProject alias to locate the tools project:

#addin "Cake.MiniCover"

SetMiniCoverToolsProject("./minicover/minicover.csproj");

// ...

Task("Coverage")
    .IsDependentOn("build")
    .Does(() => 
{
    MiniCover(tool =>
        {
            foreach(var project in GetFiles("./test/**/*.csproj"))
            {
                tool.DotNetCoreTest(project.FullPath, new DotNetCoreTestSettings()
                {
                    // Required to keep instrumentation added by MiniCover
                    NoBuild = true,
                    Configuration = configuration
                });
            }
        },
        new MiniCoverSettings()
            .WithAssembliesMatching("./test/**/*.dll")
            .WithSourcesMatching("./src/**/*.cs")
            .GenerateReport(ReportType.CONSOLE | ReportType.XML)
    );
});

// ...

If you need more fine-graned control or have multiple test targets, you can call the aliases individually:

#addin "Cake.MiniCover"

SetMiniCoverToolsProject("./minicover/minicover.csproj");

// ...

Task("Test::Prepare")
    .Does(() => 
{
    MiniCoverInstrument(
        new MiniCoverSettings()
            .WithAssembliesMatching("./test/**/*.dll")
            .WithSourcesMatching("./src/**/*.cs")
    );
    MiniCoverReset();
});

Task("Test")
    .IsDependentOn("Test::Prepare")
    .Does(() => 
{
    DotNetCoreTest(...);
    MiniCoverUninstrument();
    MiniCoverReport(new MiniCoverSettings().GenerateReport(ReportType.CONSOLE | ReportType.XML));
})

License

Cake.MiniCover is licensed under the MIT License. It makes use of MiniCover, which is licensed under the MIT License. It is based off of Cake.Common.Tools.OpenCover, which is licensed under the MIT License.

You can’t perform that action at this time.