From 13d18f9210d2959b5192e8d306af11b2fd79bebe Mon Sep 17 00:00:00 2001 From: AdmiringWorm Date: Sat, 11 Jul 2020 19:47:11 +0200 Subject: [PATCH 1/2] (build) Corrected unit test for how codecov-exe expects files to be passed --- Source/Cake.Codecov.Tests/CodecovAliasesTests.cs | 4 ++-- Source/Cake.Codecov.Tests/CodecovRunnerTests.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Cake.Codecov.Tests/CodecovAliasesTests.cs b/Source/Cake.Codecov.Tests/CodecovAliasesTests.cs index 16f8d1e..4ee1713 100644 --- a/Source/Cake.Codecov.Tests/CodecovAliasesTests.cs +++ b/Source/Cake.Codecov.Tests/CodecovAliasesTests.cs @@ -52,7 +52,7 @@ public void Should_Use_Specified_Files() var result = fixture.Run(); - result.Args.Should().Contain($"--file \"{string.Join(" ", files)}\""); + result.Args.Should().Contain($"--file \"{string.Join("\" \"", files)}\""); } [Fact] @@ -78,7 +78,7 @@ public void Should_Use_Specified_Files_And_Token() result.Args.Should() .ContainAll(new[] { - $"--file \"{string.Join(" ", files)}\"", + $"--file \"{string.Join("\" \"", files)}\"", $"--token \"{token}\"" }); } diff --git a/Source/Cake.Codecov.Tests/CodecovRunnerTests.cs b/Source/Cake.Codecov.Tests/CodecovRunnerTests.cs index 34682bf..f9422eb 100644 --- a/Source/Cake.Codecov.Tests/CodecovRunnerTests.cs +++ b/Source/Cake.Codecov.Tests/CodecovRunnerTests.cs @@ -265,7 +265,7 @@ public void Should_Set_Envs() var result = fixture.Run(); // Then - result.Args.Should().Be(@"--env ""env1 env2"""); + result.Args.Should().Be(@"--env ""env1"" ""env2"""); } [Fact] @@ -291,7 +291,7 @@ public void Should_Set_Files() var result = fixture.Run(); // Then - result.Args.Should().Be(@"--file ""file1.xml file2.xml"""); + result.Args.Should().Be(@"--file ""file1.xml"" ""file2.xml"""); } [Fact] From fafc5c90287606dde290265bc7d28e1982cf7ab7 Mon Sep 17 00:00:00 2001 From: AdmiringWorm Date: Sat, 11 Jul 2020 20:03:15 +0200 Subject: [PATCH 2/2] (GH-101) Correct the way Cake.Codecov passes file paths fixes #101 --- Source/Cake.Codecov/CodecovRunner.cs | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/Source/Cake.Codecov/CodecovRunner.cs b/Source/Cake.Codecov/CodecovRunner.cs index 1117f2c..6dd84bc 100644 --- a/Source/Cake.Codecov/CodecovRunner.cs +++ b/Source/Cake.Codecov/CodecovRunner.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using Cake.Codecov.Internals; using Cake.Core; @@ -57,8 +58,11 @@ protected override IEnumerable GetToolExecutableNames() private static void AddValue(ProcessArgumentBuilder builder, string key, IEnumerable value) { - var joinedValue = string.Join(" ", value); - AddValue(builder, key, joinedValue); + AddValue(builder, key, value.FirstOrDefault()); + foreach (var subValue in value.Skip(1)) + { + AddValue(builder, key, subValue, true); + } } private static void AddValue(ProcessArgumentBuilder builder, string key, Uri value) @@ -77,15 +81,29 @@ private static void AddValue(ProcessArgumentBuilder builder, KeyValuePair