Skip to content

Commit 16c9ae3

Browse files
Copilotthomhurst
andcommitted
Replace verbosity flags approach with CliWrap output suppression for successful operations
Co-authored-by: thomhurst <[email protected]>
1 parent 95ae018 commit 16c9ae3

File tree

6 files changed

+15
-21
lines changed

6 files changed

+15
-21
lines changed

.github/actions/execute-pipeline/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ runs:
3030
steps:
3131
- name: Run Pipeline
3232
shell: bash
33-
run: dotnet run -c Release --verbosity quiet --categories ${{ inputs.categories }}
33+
run: dotnet run -c Release --categories ${{ inputs.categories }}
3434
working-directory: "TUnit.Pipeline"
3535
env:
3636
ADMIN_TOKEN: ${{ inputs.admin-token }}

.github/workflows/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
run: npx playwright install
6565

6666
- name: Build
67-
run: dotnet build -c Release --verbosity quiet
67+
run: dotnet build -c Release
6868

6969
- name: Run Pipeline
7070
uses: ./.github/actions/execute-pipeline

TUnit.Engine.Tests/GlobalHooks.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,18 @@ public class GlobalHooks
55
[Before(TestSession)]
66
public static async Task BuildTestProject()
77
{
8-
await CliWrap.Cli.Wrap("dotnet")
8+
var result = await CliWrap.Cli.Wrap("dotnet")
99
.WithArguments(["build", "-c", "Release"])
1010
.WithWorkingDirectory(FileSystemHelpers.FindFile(x => x.Name == "TUnit.TestProject.csproj")!.DirectoryName!)
11-
.ExecuteAsync();
11+
.WithValidation(CliWrap.CommandResultValidation.None)
12+
.ExecuteBufferedAsync();
13+
14+
// Only show output if the command failed
15+
if (result.ExitCode != 0)
16+
{
17+
Console.WriteLine(result.StandardOutput);
18+
Console.Error.WriteLine(result.StandardError);
19+
throw new InvalidOperationException($"Build failed with exit code {result.ExitCode}");
20+
}
1221
}
1322
}

TUnit.Pipeline/Modules/Abstract/TestBaseModule.cs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,33 +44,18 @@ protected virtual IEnumerable<string> TestableFrameworks
4444

4545
private DotNetRunOptions SetDefaults(DotNetRunOptions testOptions)
4646
{
47-
// Add quiet verbosity to reduce output for successful test runs
48-
var arguments = testOptions.Arguments?.ToList() ?? [];
49-
50-
// Add TUnit verbosity control (only if not already specified)
51-
if (!arguments.Any(arg => arg.StartsWith("--verbosity")))
52-
{
53-
arguments.AddRange(["--verbosity", "minimal"]);
54-
}
47+
// Removed --fail-fast to allow all tests to run even if some fail
5548

5649
if (testOptions.EnvironmentVariables?.Any(x => x.Key == "NET_VERSION") != true)
5750
{
5851
testOptions = testOptions with
5952
{
60-
Arguments = [.. arguments],
6153
EnvironmentVariables = new Dictionary<string, string?>
6254
{
6355
["NET_VERSION"] = testOptions.Framework,
6456
}
6557
};
6658
}
67-
else
68-
{
69-
testOptions = testOptions with
70-
{
71-
Arguments = [.. arguments]
72-
};
73-
}
7459

7560
return testOptions;
7661
}

TUnit.Pipeline/Modules/PackTUnitFilesModule.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ await context.DotNet()
3939
],
4040
IncludeSource = project == Sourcy.DotNet.Projects.TUnit_Templates ? false : true,
4141
Configuration = Configuration.Release,
42-
Verbosity = "quiet", // Reduce output for successful packs
4342
}, cancellationToken);
4443

4544
packedProjects.Add(new PackedProject(project.NameWithoutExtension, version.SemVer!));

TUnit.Pipeline/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.CommandLine;
22
using Microsoft.Extensions.Configuration;
33
using Microsoft.Extensions.DependencyInjection;
4+
using Microsoft.Extensions.Logging;
45
using ModularPipelines.Extensions;
56
using ModularPipelines.Host;
67
using ModularPipelines.Options;

0 commit comments

Comments
 (0)