Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix outputting help #46271

Merged
merged 4 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ internal event EventHandler OnProgressStopUpdate

private readonly uint? _originalConsoleMode;
private bool _isDiscovery;
private bool _isHelp;
private DateTimeOffset? _testExecutionStartTime;

private DateTimeOffset? _testExecutionEndTime;
Expand Down Expand Up @@ -147,9 +148,10 @@ public TerminalTestReporter(IConsole console, TerminalTestReporterOptions option
_terminalWithProgress = terminalWithProgress;
}

public void TestExecutionStarted(DateTimeOffset testStartTime, int workerCount, bool isDiscovery)
public void TestExecutionStarted(DateTimeOffset testStartTime, int workerCount, bool isDiscovery, bool isHelp)
{
_isDiscovery = isDiscovery;
_isHelp = isHelp;
_testExecutionStartTime = testStartTime;
_terminalWithProgress.StartShowingProgress(workerCount);
}
Expand Down Expand Up @@ -189,7 +191,10 @@ public void TestExecutionCompleted(DateTimeOffset endTime)
_testExecutionEndTime = endTime;
_terminalWithProgress.StopShowingProgress();

_terminalWithProgress.WriteToTerminal(_isDiscovery ? AppendTestDiscoverySummary : AppendTestRunSummary);
if (!_isHelp)
{
_terminalWithProgress.WriteToTerminal(_isDiscovery ? AppendTestDiscoverySummary : AppendTestRunSummary);
}

NativeMethods.RestoreConsoleMode(_originalConsoleMode);
_assemblies.Clear();
Expand Down Expand Up @@ -757,7 +762,7 @@ internal void AssemblyRunCompleted(string assembly, string? targetFramework, str

_terminalWithProgress.RemoveWorker(assemblyRun.SlotIndex);

if (!_isDiscovery && _options.ShowAssembly && _options.ShowAssemblyStartAndComplete)
if (!_isHelp && !_isDiscovery && _options.ShowAssembly && _options.ShowAssemblyStartAndComplete)
{
_terminalWithProgress.WriteToTerminal(terminal => AppendAssemblySummary(assemblyRun, terminal));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private void InitializeOutput(int degreeOfParallelism)

if (!_isHelp)
{
_output.TestExecutionStarted(DateTimeOffset.Now, degreeOfParallelism, _isDiscovery);
_output.TestExecutionStarted(DateTimeOffset.Now, degreeOfParallelism, _isDiscovery, _isHelp);
}
}

Expand Down Expand Up @@ -177,10 +177,7 @@ private void CompleteRun()
{
if (Interlocked.CompareExchange(ref _cancelled, 1, 0) == 0)
{
if (!_isHelp)
{
_output?.TestExecutionCompleted(DateTimeOffset.Now);
}
_output?.TestExecutionCompleted(DateTimeOffset.Now);
}
}

Expand Down
Loading