From f4358d4a5195c5768b88171168392cd926c265d6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 18 Nov 2025 12:20:36 +0000 Subject: [PATCH 1/3] Initial plan From 8df595011a00c4e564117a483cd9db0c12d3cccd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 18 Nov 2025 12:38:14 +0000 Subject: [PATCH 2/3] Fix test duration display to not show 0 when duration is null Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com> --- .../Test/MTP/Terminal/TerminalTestReporter.cs | 17 ++++++++++------- .../Commands/Test/MTP/TestApplicationHandler.cs | 4 ++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Cli/dotnet/Commands/Test/MTP/Terminal/TerminalTestReporter.cs b/src/Cli/dotnet/Commands/Test/MTP/Terminal/TerminalTestReporter.cs index 22929d8dfb7f..b90404a1b0c4 100644 --- a/src/Cli/dotnet/Commands/Test/MTP/Terminal/TerminalTestReporter.cs +++ b/src/Cli/dotnet/Commands/Test/MTP/Terminal/TerminalTestReporter.cs @@ -1,12 +1,12 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Concurrent; -using Microsoft.TemplateEngine.Cli.Help; using System.Globalization; using System.Text.RegularExpressions; using Microsoft.CodeAnalysis; -using Microsoft.Testing.Platform.OutputDevice.Terminal; using Microsoft.DotNet.Cli.Commands.Test.IPC.Models; +using Microsoft.TemplateEngine.Cli.Help; +using Microsoft.Testing.Platform.OutputDevice.Terminal; namespace Microsoft.DotNet.Cli.Commands.Test.Terminal; @@ -397,7 +397,7 @@ internal void TestCompleted( string displayName, string? informativeMessage, TestOutcome outcome, - TimeSpan duration, + TimeSpan? duration, FlatException[]? exceptions, string? expected, string? actual, @@ -458,7 +458,7 @@ internal void TestCompleted( string displayName, string? informativeMessage, TestOutcome outcome, - TimeSpan duration, + TimeSpan? duration, FlatException[]? flatExceptions, string? expected, string? actual, @@ -496,9 +496,12 @@ internal void TestCompleted( terminal.ResetColor(); terminal.Append(' '); terminal.Append(displayName); - terminal.SetColor(TerminalColor.DarkGray); - terminal.Append(' '); - AppendLongDuration(terminal, duration); + if (duration.HasValue) + { + terminal.SetColor(TerminalColor.DarkGray); + terminal.Append(' '); + AppendLongDuration(terminal, duration.Value); + } if (!string.IsNullOrEmpty(informativeMessage)) { diff --git a/src/Cli/dotnet/Commands/Test/MTP/TestApplicationHandler.cs b/src/Cli/dotnet/Commands/Test/MTP/TestApplicationHandler.cs index f9ea07e8e866..8db706d7c382 100644 --- a/src/Cli/dotnet/Commands/Test/MTP/TestApplicationHandler.cs +++ b/src/Cli/dotnet/Commands/Test/MTP/TestApplicationHandler.cs @@ -143,7 +143,7 @@ internal void OnTestResultsReceived(TestResultMessages testResultMessage) testResult.DisplayName!, testResult.Reason, ToOutcome(testResult.State), - TimeSpan.FromTicks(testResult.Duration ?? 0), + testResult.Duration.HasValue ? TimeSpan.FromTicks(testResult.Duration.Value) : null, exceptions: null, expected: null, actual: null, @@ -158,7 +158,7 @@ internal void OnTestResultsReceived(TestResultMessages testResultMessage) testResult.DisplayName!, testResult.Reason, ToOutcome(testResult.State), - TimeSpan.FromTicks(testResult.Duration ?? 0), + testResult.Duration.HasValue ? TimeSpan.FromTicks(testResult.Duration.Value) : null, exceptions: [.. testResult.Exceptions!.Select(fe => new Terminal.FlatException(fe.ErrorMessage, fe.ErrorType, fe.StackTrace))], expected: null, actual: null, From 90c4ab86a6fc074193a2d2604ce64b06484ee10e Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Tue, 18 Nov 2025 13:42:52 +0100 Subject: [PATCH 3/3] Cleanup --- .../dotnet/Commands/Test/MTP/Terminal/TerminalTestReporter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cli/dotnet/Commands/Test/MTP/Terminal/TerminalTestReporter.cs b/src/Cli/dotnet/Commands/Test/MTP/Terminal/TerminalTestReporter.cs index b90404a1b0c4..b41c516cb27b 100644 --- a/src/Cli/dotnet/Commands/Test/MTP/Terminal/TerminalTestReporter.cs +++ b/src/Cli/dotnet/Commands/Test/MTP/Terminal/TerminalTestReporter.cs @@ -496,9 +496,9 @@ internal void TestCompleted( terminal.ResetColor(); terminal.Append(' '); terminal.Append(displayName); + if (duration.HasValue) { - terminal.SetColor(TerminalColor.DarkGray); terminal.Append(' '); AppendLongDuration(terminal, duration.Value); }