diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..bbeb3c6 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,11 @@ +## Context +TBD + +## Description +TBD + +## Changes in the codebase +TBD + +## Associated Issues +No issue associated \ No newline at end of file diff --git a/src/DotNetRunner/DotNetTestRunner.cs b/src/DotNetRunner/DotNetTestRunner.cs index e98009a..b84b0e1 100644 --- a/src/DotNetRunner/DotNetTestRunner.cs +++ b/src/DotNetRunner/DotNetTestRunner.cs @@ -71,7 +71,7 @@ private void HandleProcessEnd() ErrorCode = ErrorCode.WellKnownError; Log.Warning(ProcessExecution.GetError()); } - else if (HaveFailedTests()) + else if (HaveFailedTests() || HaveSimpleFailedTests()) { ErrorCode = ErrorCode.FailedTests; } @@ -102,5 +102,12 @@ private void HandleProcessEnd() /// /// private bool HaveFailedTests() => ExitCode == 1 && - (ProcessExecution.GetOutput().Contains("Failed! - Failed:")); + ProcessExecution.GetOutput().Contains("Failed! - Failed:"); + + /// + /// Check if the output of dotnet test have in the last line failed tests + /// + /// + private bool HaveSimpleFailedTests() => ExitCode == 1 && + ProcessExecution.GetOutput().Contains("Failed:"); } \ No newline at end of file diff --git a/test/dotnet-test-rerun.IntegrationTests/DotNetTestRerunTests.cs b/test/dotnet-test-rerun.IntegrationTests/DotNetTestRerunTests.cs index 5c1aa32..927e532 100644 --- a/test/dotnet-test-rerun.IntegrationTests/DotNetTestRerunTests.cs +++ b/test/dotnet-test-rerun.IntegrationTests/DotNetTestRerunTests.cs @@ -168,6 +168,36 @@ public async Task DotnetTestRerun_FailingXUnit_Fails() Environment.ExitCode.Should().Be(1); } + [InlineData("normal")] + [InlineData("quiet")] + [InlineData("minimal")] + [InlineData("detailed")] + [InlineData("diagnostic")] + public async Task DotnetTestRerun_FailingXUnit_WithVerbosity_Fails(string verbosity) + { + // Arrange + Environment.ExitCode = 0; + + // Arrange + var testDir = TestUtilities.GetTmpDirectory(); + TestUtilities.CopyFixture(string.Empty, new DirectoryInfo(testDir)); + Environment.ExitCode = 0; + + // Act + var output = await RunDotNetTestRerunAndCollectOutputMessage("FailingXUnitExample", dir: testDir, extraArgs: $"--verbosity {verbosity}"); + + // Assert + output.Should().NotContain("Passed!"); + output.Should().Contain("Failed:", Exactly.Times(4)); + output.Should().Contain("Rerun filter: FullyQualifiedName~FailingXUnitExample.SimpleTest.SimpleStringCompare", + Exactly.Thrice()); + output.Should().Contain("Passed: 4", + Exactly.Once()); + var files = FileSystem.Directory.EnumerateFiles(testDir, "*trx"); + files.Should().HaveCount(4); + Environment.ExitCode.Should().Be(1); + } + [Fact] public async Task DotnetTestRerun_FailingXUnit_WithMultipleFrameworks_Fails() { diff --git a/test/dotnet-test-rerun.IntegrationTests/dotnet-test-rerun.IntegrationTests.csproj b/test/dotnet-test-rerun.IntegrationTests/dotnet-test-rerun.IntegrationTests.csproj index a9aab76..0bda679 100644 --- a/test/dotnet-test-rerun.IntegrationTests/dotnet-test-rerun.IntegrationTests.csproj +++ b/test/dotnet-test-rerun.IntegrationTests/dotnet-test-rerun.IntegrationTests.csproj @@ -17,7 +17,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/test/dotnet-test-rerun.UnitTests/dotnet-test-rerun.UnitTests.csproj b/test/dotnet-test-rerun.UnitTests/dotnet-test-rerun.UnitTests.csproj index b8946c3..d1d5cef 100644 --- a/test/dotnet-test-rerun.UnitTests/dotnet-test-rerun.UnitTests.csproj +++ b/test/dotnet-test-rerun.UnitTests/dotnet-test-rerun.UnitTests.csproj @@ -17,7 +17,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive