diff --git a/src/Cli/dotnet/commands/dotnet-test/Terminal/TerminalTestReporter.cs b/src/Cli/dotnet/commands/dotnet-test/Terminal/TerminalTestReporter.cs index d9c621862c39..ef1e789df7a4 100644 --- a/src/Cli/dotnet/commands/dotnet-test/Terminal/TerminalTestReporter.cs +++ b/src/Cli/dotnet/commands/dotnet-test/Terminal/TerminalTestReporter.cs @@ -47,6 +47,7 @@ internal event EventHandler OnProgressStopUpdate private readonly uint? _originalConsoleMode; private bool _isDiscovery; + private bool _isHelp; private DateTimeOffset? _testExecutionStartTime; private DateTimeOffset? _testExecutionEndTime; @@ -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); } @@ -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(); @@ -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)); } diff --git a/src/Cli/dotnet/commands/dotnet-test/TestingPlatformCommand.cs b/src/Cli/dotnet/commands/dotnet-test/TestingPlatformCommand.cs index 42528d8b6f88..b9ab0a3180a7 100644 --- a/src/Cli/dotnet/commands/dotnet-test/TestingPlatformCommand.cs +++ b/src/Cli/dotnet/commands/dotnet-test/TestingPlatformCommand.cs @@ -114,7 +114,7 @@ private void InitializeOutput(int degreeOfParallelism) if (!_isHelp) { - _output.TestExecutionStarted(DateTimeOffset.Now, degreeOfParallelism, _isDiscovery); + _output.TestExecutionStarted(DateTimeOffset.Now, degreeOfParallelism, _isDiscovery, _isHelp); } } @@ -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); } }