Skip to content

Commit

Permalink
(GH-93) Add support for toggling features in codecov-exe
Browse files Browse the repository at this point in the history
  • Loading branch information
AdmiringWorm committed Jul 7, 2020
1 parent 6a0e8f3 commit 217b81c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Source/Cake.Codecov.Tests/CodecovRunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,19 @@ public void Should_Set_Envs()
result.Args.Should().Be(@"--env ""env1 env2""");
}

[Fact]
public void Should_Set_Features()
{
// Given
var fixture = new CodecovRunnerFixture { Settings = { Features = new[] { "s3" } } };

// When
var result = fixture.Run();

// Then
result.Args.Should().Be("--feature \"s3\"");
}

[Fact]
public void Should_Set_Files()
{
Expand Down
15 changes: 15 additions & 0 deletions Source/Cake.Codecov.Tests/CodecovSettingsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,21 @@ public void Should_Set_Envs_Value()
settings.Envs.Should().HaveCount(expected.Length).And.BeSameAs(expected);
}

[Fact]
public void Should_Set_Feature_Value()
{
// Given
var expected = new[] { "s3" };
var settings = new CodecovSettings
{
// When
Features = expected
};

// Then
settings.Features.Should().HaveCount(expected.Length).And.BeSameAs(expected);
}

[Fact]
public void Should_Set_Files_Value()
{
Expand Down
12 changes: 12 additions & 0 deletions Source/Cake.Codecov/CodecovSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ public IEnumerable<string> Envs
set => SetValue("--env", value);
}

/// <summary>
/// Gets or sets a value specifying which flags should be toggled on/off.
/// </summary>
public IEnumerable<string> Features
{
get => GetValue<IEnumerable<string>>("--feature");
set => SetValue("--feature", value);
}

/// <summary>
/// Gets or sets a value specifing the target file(s) to upload. (1) -f 'path/to/file'. Only
/// upload this file. (2) -f 'path/to/file1 path/to/file2'. Only upload these files.
Expand All @@ -94,6 +103,9 @@ public IEnumerable<string> Envs
/// A value specifing the target file(s) to upload. (1) -f 'path/to/file'. Only upload this
/// file. (2) -f 'path/to/file1 path/to/file2'. Only upload these files.
/// </value>
/// <remarks>
/// Globbing in file paths are supported, but not when path starts with './'.
/// </remarks>
public IEnumerable<string> Files
{
get => GetValue<IEnumerable<string>>("--file");
Expand Down

0 comments on commit 217b81c

Please sign in to comment.