Skip to content

Commit ce84425

Browse files
committed
Test to make sure #675 is really fixed
1 parent d6289ba commit ce84425

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

src/GitVersionExe.Tests/GitVersionExe.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
<Compile Include="ExecutionResults.cs" />
115115
<Compile Include="GitVersionHelper.cs" />
116116
<Compile Include="HelpWriterTests.cs" />
117+
<Compile Include="JsonOutputOnBuildServer.cs" />
117118
<Compile Include="MsBuildProjectArgTest.cs" />
118119
<Compile Include="PullRequestInTeamCityTest.cs" />
119120
<Compile Include="AssemblyInfoFileUpdateTests.cs" />

src/GitVersionExe.Tests/GitVersionHelper.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ public static ExecutionResults ExecuteIn(string workingDirectory,
2020
return ExecuteIn(args);
2121
}
2222

23-
2423
public static ExecutionResults ExecuteIn(string workingDirectory, string arguments, bool isTeamCity = false, bool logToFile = true)
2524
{
2625
var logFile = logToFile ? Path.Combine(workingDirectory, "log.txt") : null;
2726
var args = new ArgumentBuilder(workingDirectory, arguments, isTeamCity, logFile);
2827
return ExecuteIn(args);
2928
}
3029

31-
3230
static ExecutionResults ExecuteIn(ArgumentBuilder arguments)
3331
{
3432
var gitHubFlowVersion = Path.Combine(PathHelper.GetCurrentDirectory(), "GitVersion.exe");
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
namespace GitVersionExe.Tests
2+
{
3+
using GitVersion;
4+
using NUnit.Framework;
5+
using Shouldly;
6+
7+
public class JsonOutputOnBuildServer
8+
{
9+
[Test]
10+
public void BeingOnBuildServerDoesntOverrideOutputJson()
11+
{
12+
using (var fixture = new RemoteRepositoryFixture(new Config()))
13+
{
14+
fixture.Repository.MakeATaggedCommit("1.2.3");
15+
fixture.Repository.MakeACommit();
16+
17+
var result = GitVersionHelper.ExecuteIn(fixture.LocalRepositoryFixture.RepositoryPath, arguments: " /output json", isTeamCity: true);
18+
19+
result.ExitCode.ShouldBe(0);
20+
result.Output.ShouldStartWith("{");
21+
result.Output.TrimEnd().ShouldEndWith("}");
22+
}
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)