Closed giggio closed 6 years ago
That's a great idea. Let me add it as a feature for the next release.
@giggio Hi there, this has now been released as 1.2.1. Please let me know if you have any issues.
Thanks @Romanx! I have tested it and I'm getting this error:
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.<DotNetCoreTest>b__0(ProcessArgumentBuilder args)
at Cake.Core.Tooling.Tool`1.RunProcess(TSettings settings, ProcessArgumentBuilder arguments, ProcessSettings processSettings)
at Cake.Core.Tooling.Tool`1.Run(TSettings settings, ProcessArgumentBuilder arguments, ProcessSettings processSettings, Action`1 postAction)
at Cake.Common.Tools.DotNetCore.Test.DotNetCoreTester.Test(String project, DotNetCoreTestSettings settings)
at Submission#0.DotNetCoreTest(FilePath project, DotNetCoreTestSettings settings, CoverletSettings coverletSettings)
at Submission#0.<<Initialize>>b__0_25()
at Cake.Core.CakeTaskBuilderExtensions.<>c__DisplayClass20_0.<Does>b__0(ICakeContext x)
at Cake.Core.CakeTask.<Execute>d__43.MoveNext()
If I pin the addin to version 1.1.4 it keeps working.
This is my config:
Task("RunUnitTestWithCoverage")
.Does(() => DotNetCoreTest("./Test/", new DotNetCoreTestSettings {
NoBuild = true,
Verbosity = DotNetCoreVerbosity.Minimal,
Configuration = configuration,
TestAdapterPath = ".",
Logger = "trx"
}, new CoverletSettings {
CollectCoverage = true,
CoverletOutputFormat = CoverletOutputFormat.opencover | CoverletOutputFormat.cobertura | CoverletOutputFormat.lcov,
CoverletOutputDirectory = Directory("./TestResults/"),
Exclude = new List<string> { "[Services]*" }
}));
Right now you can only use
CoverletOutputDirectory
ifCoverletOutputName
is set, as seen on:https://github.com/Romanx/Cake.Coverlet/blob/dbc0b4ca7ab5246526a69a146c6ca57b3a9fe631/src/Cake.Coverlet/CoverletAliases.cs#L63-L71
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.