From ed4df9b89cc485531a56b7ac60a0e38053bbcb08 Mon Sep 17 00:00:00 2001 From: Lucas Teles Date: Wed, 23 Dec 2020 12:58:12 -0300 Subject: [PATCH 1/3] changing the output format to receive a list of formats --- help/markdown/dotnet-testing-coverlet.md | 2 +- src/app/Fake.DotNet.Testing.Coverlet/Coverlet.fs | 10 +++++++--- .../Fake.DotNet.Testing.Coverlet.fs | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/help/markdown/dotnet-testing-coverlet.md b/help/markdown/dotnet-testing-coverlet.md index fca4d1cd18e..dd64b8eadc5 100644 --- a/help/markdown/dotnet-testing-coverlet.md +++ b/help/markdown/dotnet-testing-coverlet.md @@ -47,7 +47,7 @@ DotNet.test (fun p -> } |> Coverlet.withDotNetTestOptions (fun p -> { p with - OutputFormat = Coverlet.OutputFormat.OpenCover + OutputFormat = [Coverlet.OutputFormat.OpenCover] Output = "coverage.xml" Include = [ // Include all namespaces from assemblies whose name starts with MyProject diff --git a/src/app/Fake.DotNet.Testing.Coverlet/Coverlet.fs b/src/app/Fake.DotNet.Testing.Coverlet/Coverlet.fs index 9cecc0a25f7..802bccdc78a 100644 --- a/src/app/Fake.DotNet.Testing.Coverlet/Coverlet.fs +++ b/src/app/Fake.DotNet.Testing.Coverlet/Coverlet.fs @@ -27,7 +27,7 @@ type ThresholdStat = /// Coverlet MSBuild parameters. For more details see: https://github.com/tonerdo/coverlet/blob/master/Documentation/MSBuildIntegration.md type CoverletParams = { /// (Required) Format of the generated output. - OutputFormat : OutputFormat + OutputFormat : OutputFormat list /// (Required) Path to the generated output file, or directory if it ends with a `/`. Output : string /// Namespaces to include, as (AssemblyName, Namespace) pairs. Supports `*` and `?` globbing. @@ -51,7 +51,7 @@ type CoverletParams = /// The default parameters. let private defaults = - { OutputFormat = OutputFormat.Json + { OutputFormat = [OutputFormat.Json] Output = "./" Include = [] Exclude = [] @@ -70,6 +70,10 @@ let private outputFormatToString = function | OutputFormat.Cobertura -> "cobertura" | OutputFormat.TeamCity -> "teamcity" +let private outputFormatListToString = + List.map outputFormatToString + >> String.concat "," + let private namespacesToString = Seq.map (fun (asm, ns) -> "[" + asm + "]" + ns) >> String.concat "," @@ -90,7 +94,7 @@ let withMSBuildArguments (param: CoverletParams -> CoverletParams) (args: MSBuil let properties = [ yield "CollectCoverage", "true" - yield "CoverletOutputFormat", outputFormatToString param.OutputFormat + yield "CoverletOutputFormat", outputFormatListToString param.OutputFormat yield "CoverletOutput", param.Output if not (List.isEmpty param.Include) then yield "Include", namespacesToString param.Include diff --git a/src/test/Fake.Core.UnitTests/Fake.DotNet.Testing.Coverlet.fs b/src/test/Fake.Core.UnitTests/Fake.DotNet.Testing.Coverlet.fs index 4036e6c104c..4215b5b67db 100644 --- a/src/test/Fake.Core.UnitTests/Fake.DotNet.Testing.Coverlet.fs +++ b/src/test/Fake.Core.UnitTests/Fake.DotNet.Testing.Coverlet.fs @@ -16,7 +16,7 @@ let tests = testCase "Test that full properties are converted" <| fun _ -> let props = getProps (fun p -> { - OutputFormat = Coverlet.OutputFormat.Cobertura + OutputFormat = [Coverlet.OutputFormat.Cobertura; Coverlet.OutputFormat.Json] Output = "coverage.json" Include = [ "Incl.Asm1", "Incl.Ns1" @@ -38,7 +38,7 @@ let tests = Expect.containsAll props [ "CollectCoverage", "true" "CoverletOutput", "coverage.json" - "CoverletOutputFormat", "cobertura" + "CoverletOutputFormat", "cobertura,json" "Include", "[Incl.Asm1]Incl.Ns1,[Incl.Asm2]Incl.Ns2" "Exclude", "[Excl.Asm1]Excl.Ns1,[Excl.Asm2]Excl.Ns2" "ExcludeByAttribute", "Attr1,Attr2" From 75e02049e6f146639e536abd0ea279e4d3a6b1ce Mon Sep 17 00:00:00 2001 From: Lucas Teles Date: Tue, 23 Mar 2021 21:28:54 -0300 Subject: [PATCH 2/3] wip --- src/app/Fake.DotNet.Testing.Coverlet/Coverlet.fs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/Fake.DotNet.Testing.Coverlet/Coverlet.fs b/src/app/Fake.DotNet.Testing.Coverlet/Coverlet.fs index 802bccdc78a..93b7460e7e2 100644 --- a/src/app/Fake.DotNet.Testing.Coverlet/Coverlet.fs +++ b/src/app/Fake.DotNet.Testing.Coverlet/Coverlet.fs @@ -121,3 +121,4 @@ let withMSBuildArguments (param: CoverletParams -> CoverletParams) (args: MSBuil /// Add Coverlet parameters to the dotnet test command. let withDotNetTestOptions (param: CoverletParams -> CoverletParams) (options: DotNet.TestOptions) = { options with MSBuildParams = withMSBuildArguments param options.MSBuildParams } + From 2a08dc187c16d10d78ffea9601c502eea398ec5e Mon Sep 17 00:00:00 2001 From: Lucas Teles Date: Wed, 7 Apr 2021 17:44:19 -0300 Subject: [PATCH 3/3] Revert "wip" This reverts commit 6bf28d9fd1ec7842c3acf433d8babe4e19a9b7a9. --- src/app/Fake.DotNet.Testing.Coverlet/Coverlet.fs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/Fake.DotNet.Testing.Coverlet/Coverlet.fs b/src/app/Fake.DotNet.Testing.Coverlet/Coverlet.fs index 93b7460e7e2..802bccdc78a 100644 --- a/src/app/Fake.DotNet.Testing.Coverlet/Coverlet.fs +++ b/src/app/Fake.DotNet.Testing.Coverlet/Coverlet.fs @@ -121,4 +121,3 @@ let withMSBuildArguments (param: CoverletParams -> CoverletParams) (args: MSBuil /// Add Coverlet parameters to the dotnet test command. let withDotNetTestOptions (param: CoverletParams -> CoverletParams) (options: DotNet.TestOptions) = { options with MSBuildParams = withMSBuildArguments param options.MSBuildParams } -