Skip to content

Commit 4545090

Browse files
authored
Don't use the xunit return code when running in helix only (#39271)
2 parents 2ce70fc + d4fc907 commit 4545090

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Tests/Common/Program.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,25 @@ public static int Main(string[] args)
2626
BeforeTestRun(newArgs);
2727
}
2828

29-
int returnCode;
29+
int returnCode = 0;
3030

3131
if (testCommandLine.ShowSdkInfo)
3232
{
3333
returnCode = ShowSdkInfo();
3434
}
3535
else
3636
{
37-
returnCode = Xunit.ConsoleClient.Program.Main(newArgs.ToArray());
37+
var xunitReturnCode = Xunit.ConsoleClient.Program.Main(newArgs.ToArray());
38+
if (Environment.GetEnvironmentVariable("HELIX_WORKITEM_PAYLOAD") != null)
39+
{
40+
// If we are running in Helix, we want the test work item to return 0 unless there's a crash
41+
Console.WriteLine($"Xunit return code: {xunitReturnCode}");
42+
}
43+
else
44+
{
45+
// If we are running locally, we to return the xunit return code
46+
returnCode = xunitReturnCode;
47+
}
3848
}
3949

4050
if (testCommandLine.ShouldShowHelp)

0 commit comments

Comments
 (0)