Skip to content

Commit e123a58

Browse files
committed
Bring changes from trx new verbosity levels
Can now produce less noisy output by default. Older behavior enabled by using `-v verbose`.
1 parent 227a7c9 commit e123a58

File tree

2 files changed

+41
-14
lines changed

2 files changed

+41
-14
lines changed

src/dotnet-retest/RetestCommand.cs

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.IO;
66
using System.Linq;
77
using System.Runtime.InteropServices;
8-
using System.Text.RegularExpressions;
98
using System.Threading.Tasks;
109
using CliWrap;
1110
using CliWrap.Buffered;
@@ -15,6 +14,7 @@
1514
using Spectre.Console;
1615
using Spectre.Console.Cli;
1716
using Spectre.Console.Rendering;
17+
using static Devlooped.TrxCommand;
1818
using static Spectre.Console.AnsiConsole;
1919

2020
namespace Devlooped;
@@ -66,11 +66,11 @@ public override async Task<int> ExecuteAsync(CommandContext context, RetestSetti
6666
return 1;
6767
}
6868

69-
var trx = new TrxCommand.TrxSettings
69+
var trx = new TrxSettings
7070
{
7171
Path = path ?? Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N")),
7272
Output = settings.Output,
73-
Skipped = settings.Skipped,
73+
Verbosity = settings.Verbosity,
7474
GitHubComment = settings.GitHubComment,
7575
GitHubSummary = settings.GitHubSummary,
7676
};
@@ -303,13 +303,35 @@ public int Retries
303303
[DefaultValue(false)]
304304
public bool Output { get; init; }
305305

306+
/// <summary>
307+
/// Output verbosity.
308+
/// </summary>
309+
[Description(
310+
"""
311+
Output display verbosity:
312+
- quiet: only failed tests are displayed
313+
- normal: failed and skipped tests are displayed
314+
- verbose: failed, skipped and passed tests are displayed
315+
""")]
316+
[CommandOption("-v|--verbosity")]
317+
[DefaultValue(Verbosity.Quiet)]
318+
public Verbosity Verbosity { get; set; } = Verbosity.Quiet;
319+
306320
/// <summary>
307321
/// Whether to include skipped tests in the output.
308322
/// </summary>
309323
[Description("Include skipped tests in report")]
310-
[CommandOption("--skipped")]
324+
[CommandOption("--skipped", IsHidden = true)]
311325
[DefaultValue(true)]
312-
public bool Skipped { get; init; } = true;
326+
public bool Skipped
327+
{
328+
get => Verbosity != Verbosity.Quiet;
329+
set
330+
{
331+
if (!value)
332+
Verbosity = Verbosity.Quiet;
333+
}
334+
}
313335

314336
/// <summary>
315337
/// Report as GitHub PR comment.

src/dotnet-retest/help.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@ USAGE:
33
dotnet retest [OPTIONS] [-- [dotnet test options]]
44

55
OPTIONS:
6-
DEFAULT
7-
-h, --help Prints help information
8-
-v, --version Prints version information
9-
--retries 3 Maximum retries when re-running failed tests
10-
--no-summary Whether to emit a summary to console/GitHub
11-
--output Include test output in report
12-
--skipped True Include skipped tests in report
13-
--gh-comment True Report as GitHub PR comment
14-
--gh-summary True Report as GitHub step summary
6+
DEFAULT
7+
-h, --help Prints help information
8+
-v, --version Prints version information
9+
--retries 3 Maximum retries when re-running failed tests
10+
--no-summary Whether to emit a summary to console/GitHub
11+
--output Include test output in report
12+
-v, --verbosity Quiet Output display verbosity:
13+
- quiet: only failed tests are displayed
14+
- normal: failed and skipped tests are
15+
displayed
16+
- verbose: failed, skipped and passed tests
17+
are displayed
18+
--gh-comment True Report as GitHub PR comment
19+
--gh-summary True Report as GitHub step summary
1520
```

0 commit comments

Comments
 (0)