Giter Club home page Giter Club logo

cake.coverlet's Introduction

Cake.Coverlet

Build status NuGet version

Usage

In order to use the addin please make sure you've included Coverlet in the project you wish to cover and add the following to your cake build file

#addin nuget:?package=Cake.Coverlet

You can also install coverlet as a global tool on your machine or with the Cake.DotNetTool.Module and run the command separately from MSBuild.

Note: Works with Coverlet 2.1.1 and up

Then use one of the following snippets

Task("Test")
    .IsDependentOn("Build")
    .Does<MyBuildData>((data) =>
{
    var testSettings = new DotNetTestSettings {
    };

    var coverletSettings = new CoverletSettings {
        CollectCoverage = true,
        CoverletOutputFormat = CoverletOutputFormat.opencover,
        CoverletOutputDirectory = Directory(@".\coverage-results\"),
        CoverletOutputName = $"results-{DateTime.UtcNow:dd-MM-yyyy-HH-mm-ss-FFF}"
    };

    DotNetTest("./test/My.Project.Tests/My.Project.Tests.csproj", testSetting, coverletSettings);
}

Or for when installed as a tool:

Task("Test")
    .IsDependentOn("Build")
    .Does<MyBuildData>((data) =>
{
    var coverletSettings = new CoverletSettings {
        CollectCoverage = true,
        CoverletOutputFormat = CoverletOutputFormat.opencover,
        CoverletOutputDirectory = Directory(@".\coverage-results\"),
        CoverletOutputName = $"results-{DateTime.UtcNow:dd-MM-yyyy-HH-mm-ss-FFF}"
    };

    // I want to specify the specific dll file and the project exactly.
    Coverlet(
        "./test/My.Project.Tests/bin/Debug/net46/My.Project.Tests.dll", 
        "./test/My.Project.Tests/My.Project.Tests.csproj", 
        coverletSettings);

    // I want to specify just the project file and the dll can be
    // inferred from the name of the project file.
    Coverlet(
        "./test/My.Project.Tests/My.Project.Tests.csproj", 
        coverletSettings);

    // I want to specify just the project directory, we will discover
    // any proj file in the directory (take the first) and infer the 
    // name from the found project.
    Coverlet(
        "./test/My.Project.Tests",
        coverletSettings);
}

There is an additional api exposed for transforming the output name of the coverage file at the time of calling dotnet test. This transform function follows the form Func<string, string> being passed the CoverletOutputName and the return is used for the filename.

Task("Test")
    .IsDependentOn("Build")
    .Does<MyBuildData>((data) =>
{
    var testSettings = new DotNetTestSettings {
    };

    var coverletSettings = new CoverletSettings {
        CollectCoverage = true,
        CoverletOutputFormat = CoverletOutputFormat.opencover,
        CoverletOutputDirectory = Directory(@".\coverage-results\"),
        CoverletOutputName = $"results"
        OutputNameTransformer = (fileName, directory) => $@"{directory}\{fileName}-HelloWorld"
    };

    DotNetTest("./test/Stubble.Core.Tests/Stubble.Core.Tests.csproj", testSetting, coverletSettings);
}

We expose a default transformer for the standard practice of appending the current datetime to the file as WithDateTimeTransformer()

If you wish to only change the directory that the output is written to then set the CoverletOutputDirectory and the filename handling will be done by coverlet as usual.

Setting more than one output format

You can support multiple coverlet formats by providing them like this:

var coverletSettings = new CoverletSettings {
        CollectCoverage = true,
        CoverletOutputFormat = CoverletOutputFormat.opencover | CoverletOutputFormat.cobertura,
        CoverletOutputDirectory = Directory(@".\coverage-results\"),
        CoverletOutputName = $"results-{DateTime.UtcNow:dd-MM-yyyy-HH-mm-ss-FFF}"
    };

Or by using the method on the settings class like this:

var coverletSettings = new CoverletSettings {
        CollectCoverage = true,
        CoverletOutputFormat = CoverletOutputFormat.opencover,
        CoverletOutputDirectory = Directory(@".\coverage-results\"),
        CoverletOutputName = $"results-{DateTime.UtcNow:dd-MM-yyyy-HH-mm-ss-FFF}"
    }.WithFormat(CoverletOutputFormat.cobertura);

cake.coverlet's People

Contributors

admiringworm avatar augustoproiete avatar austinlparker avatar dalibormesaric avatar flcdrg avatar glennawatson avatar romanx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cake.coverlet's Issues

Coverlet.MSbuild.Tasks.InstrumentationTask hangs on build

I have the following code in my cake build:

var testSettings = new DotNetCoreTestSettings()
{
    Configuration = configuration,
    NoBuild = true,
    ArgumentCustomization = args => args.Append($"--logger:trx /p:Exclude=\"[xunit.*]*\"")
};

var coverletSettings = new CoverletSettings {
    CollectCoverage = true,
    CoverletOutputFormat = CoverletOutputFormat.opencover,
    CoverletOutputDirectory = Directory(@".\coverage-results\"),
    CoverletOutputName = $"results-" + project.GetFilename()
};
DotNetCoreTest(project.FullPath, testSettings, coverletSettings);

Seems pretty straightforward and I've done this in a half dozen solutions and it runs great. But in one particular solution, it's just a bit larger in size than the others, when I run this through Powershell, it just hangs on the DotNetCoreTest line. When I break out, then PS starts giving me the following message over and over:

C:\myuserpath.nuget\packages\coverlet.msbuild\2.5.1\build\netstandard2.0\coverlet.msbuild.targets(7,5): warning MSB4220: Waiting for the currently executing task "Coverlet.MSbuild.Tasks.InstrumentationTask" to cancel. [C:\Projects\my project path.csproj]

Any ideas what's going on here? Not sure where to begin trying to debug this. Thanks!

e

Add Tools/Aliases to call coverlet.exe directly

๐Ÿ‘‹ Thanks for creating this project.

There are some scenarios where using coverlet.msbuild does not work and you need to use coverlet.exe. I was using this project until I realized that is my problem.

CI build failures after update to 2.5.4 from 2.5.1

Using 2.5.1 the build script is working.
Using 2.5.4 the build script is broken.

I was using
#addin nuget:?package=Cake.Coverlet

I have a workaround by downgrading to a known working version
#addin "nuget:?package=Cake.Coverlet&version=2.5.1"

Log from CI:

Acquiring lock for the installation of Cake.Coverlet 2.5.4
Acquired lock for the installation of Cake.Coverlet 2.5.4
Completed installation of Cake.Coverlet 2.5.4
Could not load C:\projects\commandlineparser-core\tools\Addins\Cake.Coverlet.2.5.4\lib\netstandard2.0\Cake.Coverlet.dll (missing Cake.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null)
Could not load C:\projects\commandlineparser-core\tools\Addins\Cake.Coverlet.2.5.4\lib\netstandard2.0\Cake.Coverlet.dll (missing Cake.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null)
Compiling build script...
C:/projects/commandlineparser-core/build.cake(37,9): warning CS0162: Unreachable code detected
dotnet-cake.exe : C:/projects/commandlineparser-core/build.cake(80,36): error CS0246: The type or namespace name 'CoverletSettings' could not be found (are you missing a using directive or an assembly reference?)
At C:\projects\commandlineparser-core\build.ps1:152 char:5
+     & "$CakeExePath" ./build.cake $args
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (C:/projects/com...bly reference?):String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

DotNetCoreTest: Object reference not set to an instance of an object

When using the DotNetCoreTest as described in the documentation I get an null reference exception. I am using the latest version of Cake.Coverlet & coverlet.msbuild (as I also experienced the issue with overwritten configurations).

Cake info:

Package Cake.Coverlet.1.1.2 has already been installed.
Successfully installed 'Cake.Coverlet 1.1.2' to /Users/jacob.duijzer/Documents/Projecten/Appcell/Redhotminute.Appollo.Cake.BuildScripts/tools/Addins
Executing nuget actions took 1.05 ms
The addin Cake.Coverlet will reference Cake.Coverlet.dll.
Verifying assembly 'System.Security.Cryptography.ProtectedData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Verifying assembly 'System.Text.Encoding.CodePages, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Verifying assembly 'System.Security.Cryptography.ProtectedData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Verifying assembly 'System.Text.Encoding.CodePages, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Verifying assembly 'Cake.Figlet, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null'.
Verifying assembly 'Cake.Xamarin, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null'.
Verifying assembly 'Cake.AppCenter, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null'.
Verifying assembly 'Cake.Tfs.Build.Variables, Version=0.0.8.0, Culture=neutral, PublicKeyToken=null'.
Verifying assembly 'Cake.Incubator, Version=2.0.2.0, Culture=neutral, PublicKeyToken=null'.
Verifying assembly 'Cake.Plist, Version=0.5.0.0, Culture=neutral, PublicKeyToken=null'.
Verifying assembly 'Cake.AndroidAppManifest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Verifying assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'.
Verifying assembly 'Cake.Coverlet, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null'.

Build script:

var testSettings = new DotNetCoreTestSettings
{
Configuration = configuration,
NoBuild = true
};

var coverletSettings = new CoverletSettings {
CollectCoverage = true,
CoverletOutputFormat = CoverletOutputFormat.opencover,
CoverletOutputDirectory = Directory(@".\coverage-results"),
CoverletOutputName = $"results-{DateTime.UtcNow:dd-MM-yyyy-HH-mm-ss-FFF}"
};

DotNetCoreTest(testProject.File, testSettings, coverletSettings);

Exception:

An error occurred when executing task 'TestCoverageReport'.
Error: System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object
at Cake.Coverlet.CoverletAliases+<>c__DisplayClass0_0.b__0 (Cake.Core.IO.ProcessArgumentBuilder args) [0x00000] in <5a96cf75f72f4de496f23eba75f8a82b>:0
at Cake.Core.Tooling.Tool1[TSettings].RunProcess (TSettings settings, Cake.Core.IO.ProcessArgumentBuilder arguments, Cake.Core.IO.ProcessSettings processSettings) [0x00034] in <dbcc84a538bf40c49cc2872ffafe2d84>:0 at Cake.Core.Tooling.Tool1[TSettings].Run (TSettings settings, Cake.Core.IO.ProcessArgumentBuilder arguments, Cake.Core.IO.ProcessSettings processSettings, System.Action1[T] postAction) [0x0001c] in <dbcc84a538bf40c49cc2872ffafe2d84>:0 at Cake.Common.Tools.DotNetCore.DotNetCoreTool1[TSettings].RunCommand (TSettings settings, Cake.Core.IO.ProcessArgumentBuilder arguments) [0x00009] in :0
at Cake.Common.Tools.DotNetCore.Test.DotNetCoreTester.Test (System.String project, Cake.Common.Tools.DotNetCore.Test.DotNetCoreTestSettings settings) [0x00018] in :0
at Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreTest (Cake.Core.ICakeContext context, System.String project, Cake.Common.Tools.DotNetCore.Test.DotNetCoreTestSettings settings) [0x00035] in :0
at Cake.Coverlet.CoverletAliases.DotNetCoreTest (Cake.Core.ICakeContext context, Cake.Core.IO.FilePath project, Cake.Common.Tools.DotNetCore.Test.DotNetCoreTestSettings settings, Cake.Coverlet.CoverletSettings coverletSettings) [0x0004a] in <5a96cf75f72f4de496f23eba75f8a82b>:0
at Submission#0.DotNetCoreTest (Cake.Core.IO.FilePath project, Cake.Common.Tools.DotNetCore.Test.DotNetCoreTestSettings settings, Cake.Coverlet.CoverletSettings coverletSettings) [0x0000c] in <3568f0f447fa464b92b26eaa31fe9227>:0
at Submission#0.<>b__0_31 () [0x000a5] in <3568f0f447fa464b92b26eaa31fe9227>:0
at Cake.Core.CakeTaskBuilderExtensions+<>c__DisplayClass6_0.b__0 (Cake.Core.ICakeContext context) [0x00000] in :0
at Cake.Core.CakeTaskBuilderExtensions+<>c__DisplayClass8_0.b__0 (Cake.Core.ICakeContext x) [0x00000] in :0
at Cake.Core.ActionTask+d__14.MoveNext () [0x00066] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in :0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in :0
at Cake.Core.DefaultExecutionStrategy+d__4.MoveNext () [0x000ee] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in :0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in :0
at Cake.Core.CakeEngine+d__29.MoveNext () [0x0013c] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in :0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in :0
at Cake.Core.CakeEngine+d__18.MoveNext () [0x00229] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in :0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <bb7b695b8c6246b3ac1646577aea7650>:0 at Cake.Scripting.BuildScriptHost+<RunTargetAsync>d__3.MoveNext () [0x0008d] in <1fcc25d1681b4774adb1422aeed887e6>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in :0
at Cake.Core.Scripting.ScriptHost.RunTarget (System.String target) [0x0000d] in :0
at Submission#0+<>d__0.MoveNext () [0x0067f] in <3568f0f447fa464b92b26eaa31fe9227>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in :0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <bb7b695b8c6246b3ac1646577aea7650>:0 at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState+<RunSubmissionsAsync>d__91[TResult].MoveNext () [0x00186] in <7d37a385ddd24eeb96bd540d739cc157>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in :0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <bb7b695b8c6246b3ac1646577aea7650>:0 at Microsoft.CodeAnalysis.Scripting.Script1+d__21[T].MoveNext () [0x000a8] in <7d37a385ddd24eeb96bd540d739cc157>:0
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in :0
at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in :0
at System.Threading.Tasks.Task.Wait () [0x00000] in :0
at Cake.Scripting.Roslyn.RoslynScriptSession.Execute (Cake.Core.Scripting.Script script) [0x0019a] in <1fcc25d1681b4774adb1422aeed887e6>:0
at Cake.Core.Scripting.ScriptRunner.Run (Cake.Core.Scripting.IScriptHost host, Cake.Core.IO.FilePath scriptPath, System.Collections.Generic.IDictionary2[TKey,TValue] arguments) [0x00358] in <dbcc84a538bf40c49cc2872ffafe2d84>:0 at Cake.Commands.BuildCommand.Execute (Cake.CakeOptions options) [0x00026] in <1fcc25d1681b4774adb1422aeed887e6>:0 at Cake.CakeApplication.Run (Cake.CakeOptions options) [0x00015] in <1fcc25d1681b4774adb1422aeed887e6>:0 at Cake.Program.Main () [0x000d1] in <1fcc25d1681b4774adb1422aeed887e6>:0 ---> (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object at Cake.Coverlet.CoverletAliases+<>c__DisplayClass0_0.<DotNetCoreTest>b__0 (Cake.Core.IO.ProcessArgumentBuilder args) [0x00000] in <5a96cf75f72f4de496f23eba75f8a82b>:0 at Cake.Core.Tooling.Tool1[TSettings].RunProcess (TSettings settings, Cake.Core.IO.ProcessArgumentBuilder arguments, Cake.Core.IO.ProcessSettings processSettings) [0x00034] in :0
at Cake.Core.Tooling.Tool1[TSettings].Run (TSettings settings, Cake.Core.IO.ProcessArgumentBuilder arguments, Cake.Core.IO.ProcessSettings processSettings, System.Action1[T] postAction) [0x0001c] in :0
at Cake.Common.Tools.DotNetCore.DotNetCoreTool1[TSettings].RunCommand (TSettings settings, Cake.Core.IO.ProcessArgumentBuilder arguments) [0x00009] in <a849174570cf4374842456f71c8c5e47>:0 at Cake.Common.Tools.DotNetCore.Test.DotNetCoreTester.Test (System.String project, Cake.Common.Tools.DotNetCore.Test.DotNetCoreTestSettings settings) [0x00018] in <a849174570cf4374842456f71c8c5e47>:0 at Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreTest (Cake.Core.ICakeContext context, System.String project, Cake.Common.Tools.DotNetCore.Test.DotNetCoreTestSettings settings) [0x00035] in <a849174570cf4374842456f71c8c5e47>:0 at Cake.Coverlet.CoverletAliases.DotNetCoreTest (Cake.Core.ICakeContext context, Cake.Core.IO.FilePath project, Cake.Common.Tools.DotNetCore.Test.DotNetCoreTestSettings settings, Cake.Coverlet.CoverletSettings coverletSettings) [0x0004a] in <5a96cf75f72f4de496f23eba75f8a82b>:0 at Submission#0.DotNetCoreTest (Cake.Core.IO.FilePath project, Cake.Common.Tools.DotNetCore.Test.DotNetCoreTestSettings settings, Cake.Coverlet.CoverletSettings coverletSettings) [0x0000c] in <3568f0f447fa464b92b26eaa31fe9227>:0 at Submission#0.<<Initialize>>b__0_31 () [0x000a5] in <3568f0f447fa464b92b26eaa31fe9227>:0 at Cake.Core.CakeTaskBuilderExtensions+<>c__DisplayClass6_0.<Does>b__0 (Cake.Core.ICakeContext context) [0x00000] in <dbcc84a538bf40c49cc2872ffafe2d84>:0 at Cake.Core.CakeTaskBuilderExtensions+<>c__DisplayClass8_0.<Does>b__0 (Cake.Core.ICakeContext x) [0x00000] in <dbcc84a538bf40c49cc2872ffafe2d84>:0 at Cake.Core.ActionTask+<Execute>d__14.MoveNext () [0x00066] in <dbcc84a538bf40c49cc2872ffafe2d84>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <bb7b695b8c6246b3ac1646577aea7650>:0 at Cake.Core.DefaultExecutionStrategy+<ExecuteAsync>d__4.MoveNext () [0x000ee] in <dbcc84a538bf40c49cc2872ffafe2d84>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <bb7b695b8c6246b3ac1646577aea7650>:0 at Cake.Core.CakeEngine+<ExecuteTaskAsync>d__29.MoveNext () [0x0013c] in <dbcc84a538bf40c49cc2872ffafe2d84>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <bb7b695b8c6246b3ac1646577aea7650>:0 at Cake.Core.CakeEngine+<RunTargetAsync>d__18.MoveNext () [0x00229] in <dbcc84a538bf40c49cc2872ffafe2d84>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in :0
at Cake.Scripting.BuildScriptHost+d__3.MoveNext () [0x0008d] in <1fcc25d1681b4774adb1422aeed887e6>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in :0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0
at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <bb7b695b8c6246b3ac1646577aea7650>:0 at Cake.Core.Scripting.ScriptHost.RunTarget (System.String target) [0x0000d] in <dbcc84a538bf40c49cc2872ffafe2d84>:0 at Submission#0+<<Initialize>>d__0.MoveNext () [0x0067f] in <3568f0f447fa464b92b26eaa31fe9227>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in :0
at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState+d__91[TResult].MoveNext () [0x00186] in <7d37a385ddd24eeb96bd540d739cc157>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <bb7b695b8c6246b3ac1646577aea7650>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in :0
at Microsoft.CodeAnalysis.Scripting.Script`1+d__21[T].MoveNext () [0x000a8] in <7d37a385ddd24eeb96bd540d739cc157>:0 <---

Any idea what could be the issue?

Multiple CoverletOutputFormat

Add support to setup List<CoverletOutputFormat>

CoverletOutputFormats = new List<CoverletOutputFormat> {
CoverletOutputFormat.opencover,
CoverletOutputFormat.covertura
};

Cake script failing after directive addin attempts to install Cake.Coverlet package. States 'The assembly name is invalid'

Here are the last entries from my cake script output. Issue started yesterday evening.

The 'addin' directive is attempting to install the 'Cake.Coverlet' package
without specifying a package version number.
More information on this can be found at https://cakebuild.net/docs/tutorials/pinning-cake-version
It's not recommended, but you can explicitly override this warning
by configuring the Skip Package Version Check setting to true
(i.e. command line parameter "--settings_skippackageversioncheck=true",
environment variable "CAKE_SETTINGS_SKIPPACKAGEVERSIONCHECK=true",
read more about configuration at https://cakebuild.net/docs/fundamentals/configuration)
Error: The assembly name is invalid.
##[error]PowerShell exited with code '1'.
Finishing: Run Cake script

Add cake-addin tag to Cake.Coverlet NuGet package

The NuGet Gallery will soon include a "Cake" tab with instructions on how to use NuGet packages in Cake build scripts. I'd like to suggest that you include the tag cake-addin in the NuGet package of this addin, so that the NuGet Gallery can display the correct instructions to install this addin.

The UI will look similar to this:

image

Documentation on best practices on tags for Cake addins: https://cakebuild.net/docs/extending/addins/best-practices#tags

Path containing spaces for CoverletOutput leads to error

I've encountered an issue when using Cake.Coverlet on my Jenkins instance (which has the workspace at its default location in Program Files (x86) for this project https://github.com/taconaut/Sppd.TeamTuner.

When running the Target Run-Unit-Tests in Jenkins (failed job), following command is being generated:
Executing: "C:/Program Files/dotnet/dotnet.exe" test "C:/Program Files (x86)/Jenkins/jobs/Sppd.TeamTuner-Deploy-Codecov/workspace/Backend/Tests/Sppd.TeamTuner.Tests.Unit/Sppd.TeamTuner.Tests.Unit.csproj" --configuration Release --no-build --no-restore /property:CollectCoverage=True /property:CoverletOutputFormat=\"opencover\" /property:CoverletOutput=C:/Program Files (x86)/Jenkins/jobs/Sppd.TeamTuner-Deploy-Codecov/workspace/coverage-results/coverage-results-unit.opencover.xml /property:Include=\"[Sppd.TeamTuner.*]*\" /property:Exclude=\"[xunit*]*,[Sppd.TeamTuner.Tests.*]*\"

And fails with: MSBUILD : error MSB1008: Only one project can be specified.

If adding (unescaped) quotes around /property:CoverletOutput, it fixes this issue: /property:CoverletOutput="C:/Program Files (x86)/Jenkins/jobs/Sppd.TeamTuner-Deploy-Codecov/workspace/coverage-results/coverage-results-unit.opencover.xml"

Coverlet does not generate any output files in cake

ITNOA

I have a project in GitHub and have a cake file that use some code like below


        var coverletSettings = new CoverletSettings {
            CollectCoverage = true,
            CoverletOutputFormat = CoverletOutputFormat.opencover,
            CoverletOutputDirectory = Directory(@"./coverage-test/"),
            CoverletOutputName = coverageResultsFileName
        };

        DotNetCoreTest(testProject, settings, coverletSettings);

but when i run test target, we cannot found any coverage-test directory?

Did you can help me? what is my problem?

thanks

Enum defined in assembly not referenced.

When trying to use Cake.Coverlet, I get an intellisense error creating a CoverletSettings - The type 'Enum' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [build.cake]

The following is the task:

Task("Test")
.IsDependentOn("Build")
.Does(() =>
	{
		var project = ("./test/LightStep.Tests/LightStep.Tests.csproj");
		var coverletSettings = new CoverletSettings {
			CollectCoverage = true,
			CoverletOutputFormat = CoverletOutputFormat.opencover,

		};
		var testSettings = new DotNetCoreTestSettings {
			Logger = "xunit;LogFilePath=../../build/test_results.xml",
			Verbosity = DotNetCoreVerbosity.Minimal
		};
		DotNetCoreTest(project, testSettings, coverletSettings);
});

I'm using Cake 0.30 on MacOS with dotnet version 2.1.401.

Running coverlet as a tool doesn't detect Test assembly correctly

I use this extension to launch the coverlet tool (not MSBuild version) and discovered that it appears the argument customization for coverlet needs a little tweak

The code is looking for the test dll using the provided configuration - but the way it passed it to the process doesn't work due to either coverlet or dotnet test - I dont know which.

Take for example this is how coverlet is currently run via this extension

coverlet --target dotnet --targetargs "test --no-build" .\bin\**Release**\netcoreapp3.1\Aggregates.NET.UnitTests.dll

however this doesn't work

Test run for C:\Projects\Common\Aggregates.NET\src\Aggregates.NET.UnitTests\bin\**Debug**\netcoreapp3.1\Aggregates.NET.UnitTests.dll (.NETCoreApp,Version=v3.1)
Microsoft (R) Test Execution Command Line Tool Version 16.8.3
Copyright (c) Microsoft Corporation.  All rights reserved.
The test source file "C:\\Projects\Common\Aggregates.NET\src\Aggregates.NET.UnitTests\bin\**Debug**\netcoreapp3.1\Aggregates.NET.UnitTests.dll" provided was not found.

For some reason even though you provide the test assembly its still trying to detect it - and incorrectly assumes Debug configuration.

The fix is to supply --configuration Release to dotnet test via target args

like so

coverlet --target dotnet --targetargs "test --no-build --configuration Release" .\Aggregates.NET.UnitTests.csproj

The type or namespace name 'CoverletSettings' could not be found.

Preparing to run build script...
Running build script...
Analyzing build script...
Processing build script...
Installing tools...
Compiling build script...
Error: C:/code/toolkit/build.cake(161,17): error CS0246: The type or namespace name 'CoverletSettings' could not be found (are you missing a using directive or an assembly reference?)

The Cake.Build Script starts:

#tool "nuget:?package=xunit.runner.console"
#tool "nuget:?package=OpenCover"
#tool "nuget:?package=ReportGenerator"
#tool "nuget:?package=Cake.Coverlet"

And the tasks that uses it:

Task("Coverage2")
.IsDependentOn("Compile")
.Does(() =>
{
CreateDirectory(buildDirectory + "\coverage");

    Coverlet(
        buildDirectory + "\\output\\UnitTest.dll",
        baseDirectory + "\\UnitTests\\UnitTests.csproj",
        new CoverletSettings {
            CollectCoverage = true,
            CoverletOutputFormat = CoverletOutputFormat.opencover,
            CoverletOutputDirectory = Directory(buildDirectory + "\\coverage"),
            CoverletOutputName = "coverage.xml"
        });

    ReportGenerator(buildDirectory + "\\coverage\\coverage.xml", buildDirectory + "\\coverage");
});

Not sure what I'm doing wrong...

Use Cake Contrib Icon

Thanks again for creating this Cake Addin, we really appreciate the effort that you have put in to creating it.

We, the Cake Team, recently announced a new Cake Contrib Icon, details of which can be found here:

http://cakebuild.net/blog/2017/06/new-cake-contrib-icon

Would you consider changing the nuspec file for your NuGet Package to use this new Cake Contrib Icon? If so, the recommended URL to use is:

https://cdn.rawgit.com/cake-contrib/graphics/a5cf0f881c390650144b2243ae551d5b9f836196/png/cake-contrib-medium.png

Details of the above URL can be found in the repository here:

https://github.com/cake-contrib/graphics

Please let me know if you have any questions.

Unable to use the target parameter on coverlet

I would like to use custom test runner with coverlet. In official docs it is possible by the argument --target.
Unfortunately, this addin to cake does not provide such param.

Can we introduce new setting to run coverlet?

Documentation for reference
https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/GlobalTool.md#code-coverage-for-integration-tests-and-end-to-end-tests

It will be great to use your addin for the end to end test coverage.

Readme.md typo?

In the Cake.Coverlet, there are a few instances where coverlet appears to be misspelled as "covelet"

one example is the instantiation of the CoverletSettings object being saved into var coveletSettings

Using `Coverlet` alias fails when projects are built in Release configuration

Currently, when trying to use the Coverlet alias, and the test projects are built with the Release Configuration (or anything other than Debug) the addin is unable to find the necessary DLL to run coverlet.console it need.

This is because it seems to be hardcoded only to check the Debug folder.

Would it be possible to make the configuration to search for the DLL configurable?

Enable usage of CoverletOutputDirectory without CoverletOutputName

Right now you can only use CoverletOutputDirectory if CoverletOutputName is set, as seen on:

if (!string.IsNullOrEmpty(settings.CoverletOutputName))
{
var dir = settings.CoverletOutputDirectory ?? project.GetDirectory();
var directoryPath = dir.MakeAbsolute(cakeContext.Environment).FullPath;
var filepath = FilePath.FromString(settings.OutputTransformer(settings.CoverletOutputName, directoryPath));
builder.AppendProperty("CoverletOutput", filepath.MakeAbsolute(cakeContext.Environment).FullPath);
}

But you should be able to use the directory without setting the output name. This is the case when you use several output formats and only want to change the directories without changing the file names.

No coverage generated with dotnet 7 SDK

Hi,

Since upgrading Visual Studio 17.4 which in turn installed dotnet 7 SDK along with MSBuild 17.4, coverlet reports are not being generated, respectively saved. Not sure if dotent, msbuild, coverlet or cake.coverlet is at cause here. Before the VS update everything has been working fine.

Installed versins:

  • dotnet --version: 7.0.100
  • dotnet msbuild --version: 17.4.0.51802
  • Cake: 3.0.0
  • Cake.Coverlet: 3.0.2

Below, the relevant parts of cake.build

var _testOutputDir = MakeAbsolute(Directory("./test-output"));
var _testCoverageResultsDir = MakeAbsolute(_testOutputDir.Combine(Directory("coverage-results")));
var _testResultsDir = MakeAbsolute(_testOutputDir.Combine(Directory ("test-results")));

Task("Build")
    .IsDependentOn("Clean")
    .IsDependentOn("Restore-NuGet-Packages")
    .Does(() => {
        DotNetBuild(
            _solutionPath,
            new DotNetBuildSettings{
                NoRestore = true,
                Configuration = _configuration
            }
        );
        Information($"Finished building solution '{_solutionPath}'.");
    });

Task("Unit-Test")
    .IsDependentOn("Build")
    .Does (() => {
        RunTests(GetFiles($"./**/{_applicationBaseName}*.Tests.Unit.csproj"));
    });

Task("Integration-Test")
    .IsDependentOn("Build")
    .Does (() => {
        RunTests(GetFiles($"./**/{_applicationBaseName}*.Tests.Integration.csproj"));
    });

Task("Test")
    .IsDependentOn("Build")
    .IsDependentOn("Unit-Test")
    .IsDependentOn("Integration-Test");

var _testSettings = new DotNetTestSettings {
    NoBuild = true,
    NoRestore = true,
    Configuration = _configuration,
    ResultsDirectory = _testResultsDir
};

var _coverletSettings = new CoverletSettings {
    CollectCoverage = true,
    CoverletOutputFormat = CoverletOutputFormat.cobertura,
    CoverletOutputDirectory = _testCoverageResultsDir,
    Exclude = new List<string> { "[xunit*]*", $"[*{_applicationBaseName}.Tests.*]*" },
    Include = new List<string> { $"[*{_applicationBaseName}*]*" }
};

private void RunTests(FilePathCollection projectFiles){
    foreach(var projectFile in projectFiles)
    {
        var projectFilePath = projectFile.Segments.Last();

        // Test result customization
        var testResultFileName = $"test-results-{projectFilePath}.xml";
        _testSettings.ArgumentCustomization = args => args.Append($"--logger:trx;LogFileName={testResultFileName}");

        // Coverage result customization
        var coverageResultFileName = $"coverage-results-{projectFilePath}.cobertura.xml";
        _coverletSettings.CoverletOutputName = coverageResultFileName;

        DotNetTest(projectFile.FullPath, _testSettings, _coverletSettings);
    }
}

Which generates the dotnet command:

"C:/Program Files/dotnet/dotnet.exe" test "D:/Dev/Infrastructure.LogAggregator/Source/Infrastructure.LogAggregator.Tests.Integration/Infrastructure.LogAggregator.Tests.Integration.csproj" --configuration Release --no-build --no-restore --results-directory "D:/Dev/Infrastructure.LogAggregator/Source/test-output/test-results" --logger:trx;LogFileName=test-results-Infrastructure.LogAggregator.Tests.Integration.csproj.xml /property:CollectCoverage=True /property:CoverletOutputFormat=\"cobertura\" /property:CoverletOutput="D:/Dev/Infrastructure.LogAggregator/Source/test-output/coverage-results/coverage-results-Infrastructure.LogAggregator.Tests.Integration.csproj.cobertura.xml" /property:Include=\"[*Infrastructure.LogAggregator*]*\" /property:Exclude=\"[xunit*]*,[*Infrastructure.LogAggregator.Tests.*]*\"

with results

Passed! - Failed: 0, Passed: 2, Skipped: 1, Total: 3, Duration: 7 ms - Infrastructure.LogAggregator.Tests.Integration.dll (net6.0)
Finished executing task: Integration-Test
Completed in 00:00:03.7075473

Task Duration

Clean 00:00:00.0918885
Restore-NuGet-Packages 00:00:00.7450063
Build 00:00:01.5529311
Integration-Test 00:00:03.7079160

Total: 00:00:06.0977419

The test result file ".\test-output\test-results\test-results-Infrastructure.LogAggregator.Tests.Integration.csproj.xml" is being generated but the coverage file, which should have been saved to .\test-output\coverage-results\ are missing (this worked fine before the VS update).

Any idea what's going on? If I have to change something on my side?

Btw I encounter other issues related to build automation since the VS update.

Recommended changes resulting from automated audit

We performed an automated audit of your Cake addin and found that it does not follow all the best practices.

We encourage you to make the following modifications:

  • You are currently referencing Cake.Core 0.28.0. Please upgrade to 0.33.0
  • You are currently referencing Cake.Common 0.28.0. Please upgrade to 0.33.0
  • The Cake.Core reference should be private. Specifically, your addin's .csproj should have a line similar to this: <PackageReference Include="Cake.Core" Version="0.33.0" PrivateAssets="All" />
  • The Cake.Common reference should be private. Specifically, your addin's .csproj should have a line similar to this: <PackageReference Include="Cake.Common" Version="0.33.0" PrivateAssets="All" />
  • The nuget package for your addin should use the cake-contrib icon. Specifically, your addin's .csproj should have a line like this: <PackageIconUrl>https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/cake-contrib-medium.png</PackageIconUrl>.

Apologies if this is already being worked on, or if there are existing open issues, this issue was created based on what is currently published for this package on NuGet.

This issue was created by a tool: Cake.AddinDiscoverer version 3.12.1

DotNetCoreTest overwrites prior defined arguments

When using the DotNetCoreTest in conjunction with CoverletSettings the previous defined arguments are thrown away.

    var settings = new DotNetCoreTestSettings {
        Configuration = configuration,
        OutputDirectory = outputDir,
        NoBuild = true,
        ArgumentCustomization = args => args.Append("-l trx")
                                            .Append($"-r {testResultsDir.ToString()}")
    };
    var coverletSettings = new CoverletSettings {
        CollectCoverage = !skipCoverage,
        CoverletOutputFormat = CoverletOutputFormat.opencover,
        CoverletOutputDirectory = testResultsDir,
        CoverletOutputName = $"coverage"
    };
    DotNetCoreTest(project.FullPath, settings, coverletSettings);

The args -l trx -r testresults gets no appended anymore.

I think the bad line is https://github.com/Romanx/Cake.Coverlet/blob/master/src/Cake.Coverlet/CoverletAliases.cs#L34 where you overwrite the delegate.

Potential issue when adding cover report in a directory on Linux OS

Using Coverlet addin 1.1.3

var path = @"./coverage-results";
EnsureDirectoryExists(path);
var curDir = MakeAbsolute(Directory(@"./coverage-results/"));
Information("Current directory is: {0}", curDir);

var coverletSettings = new CoverletSettings {
            CollectCoverage = true,
            CoverletOutputFormat = CoverletOutputFormat.opencover,
            CoverletOutputDirectory = curDir,
            CoverletOutputName = $"results"
};

Expected result

Calculating coverage result...
  Generating report '/home/BuildAgent/work/c0bd4777df028bc8/coverage-results/results.opencover.xml'

Actual result

Calculating coverage result...
   Generating report '/home/BuildAgent/work/c0bd4777df028bc8/coverage-resultsresults.opencover.xml'

image

As you can see, it's not creating the report in the directory specified.

Add cake-contrib user

First of all, I wanted to thank you for adding to the Cake community by adding this addin.

I was just wondering if you had seen this blog post:

http://cakebuild.net/blog/2016/08/cake-contribution-organization

We are currently going through a process of increasing the visibility of addins, and also trying to ensure their long term maintainability.

To that end, we are asking addin creators to add the cake-contrib user on NuGet as a co-owner (this can be done through the NuGet website by clicking on Manage Owners on the package page).

Would you be interested in doing this? If you have any questions about this, please let me know. There was some initial concern that the Cake Team were trying to "take over" packages, and that couldn't be further from the truth, and if you have this concern, or others, I would like to address them.

Thanks!

Bug: If only output directory defined, the resulting file name contain directory name.

I have the following behavior, if I set only the CoverletOutputDirectory without filename. The resulting files are written to the parent directory with combined filename of directory+format.

Example for configuration:

var covSettings = new CoverletSettings {
  CoverletOutputDirectory = Directory("./Output/TestResults"),
  CoverletOutputFormat = CoverletOutputFormat.opencover | CoverletOutputFormat. cobertura,
  CollectCoverage = true
}

I get the following dorectory / file structure:

  • Output
    • TestResults.opencoder.xml
    • TestResults.cobertura.xml

instead of the expected structure:

  • Output
    • TestResults
      • results.opencover.xml
      • results.cobertura.xml

As I see in commandl ine, the path is send without ending /, so coverlet treat this as a file.

As described here (https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/MSBuildIntegration.md) coverlet treat the CoverletOutput parameter as directory, if this ends with /, as file in other cases.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.