From d12dcd539584a1b06d7d8847a2b59e4fa17741b0 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Wed, 1 Apr 2026 13:27:32 +0200 Subject: [PATCH 1/2] dotnet test MTP: Disable ANSI output in LLM environments --- .../Commands/Test/MTP/MicrosoftTestingPlatformTestCommand.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Cli/dotnet/Commands/Test/MTP/MicrosoftTestingPlatformTestCommand.cs b/src/Cli/dotnet/Commands/Test/MTP/MicrosoftTestingPlatformTestCommand.cs index b12dc97e5a47..6a1cf35c4b0c 100644 --- a/src/Cli/dotnet/Commands/Test/MTP/MicrosoftTestingPlatformTestCommand.cs +++ b/src/Cli/dotnet/Commands/Test/MTP/MicrosoftTestingPlatformTestCommand.cs @@ -7,6 +7,7 @@ using Microsoft.DotNet.Cli.CommandLine; using Microsoft.DotNet.Cli.Commands.Test.Terminal; using Microsoft.DotNet.Cli.Extensions; +using Microsoft.DotNet.Cli.Telemetry; namespace Microsoft.DotNet.Cli.Commands.Test; @@ -106,7 +107,9 @@ private void InitializeOutput(int degreeOfParallelism, ParseResult parseResult, bool inCI = string.Equals(Environment.GetEnvironmentVariable("TF_BUILD"), "true", StringComparison.OrdinalIgnoreCase) || string.Equals(Environment.GetEnvironmentVariable("GITHUB_ACTIONS"), "true", StringComparison.OrdinalIgnoreCase); AnsiMode ansiMode = AnsiMode.AnsiIfPossible; - if (noAnsi) + // In LLM environments, prefer simple text output so that LLM can parse it easily. + // Note that NoAnsi also implies also no progress. + if (noAnsi || new LLMEnvironmentDetectorForTelemetry().IsLLMEnvironment()) { // User explicitly specified --no-ansi. // We should respect that. From ffd333d72f26fca5da805027dbfb9c6f58fb08fa Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Wed, 1 Apr 2026 13:33:07 +0200 Subject: [PATCH 2/2] Typo --- .../Commands/Test/MTP/MicrosoftTestingPlatformTestCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cli/dotnet/Commands/Test/MTP/MicrosoftTestingPlatformTestCommand.cs b/src/Cli/dotnet/Commands/Test/MTP/MicrosoftTestingPlatformTestCommand.cs index 6a1cf35c4b0c..e92590025594 100644 --- a/src/Cli/dotnet/Commands/Test/MTP/MicrosoftTestingPlatformTestCommand.cs +++ b/src/Cli/dotnet/Commands/Test/MTP/MicrosoftTestingPlatformTestCommand.cs @@ -108,7 +108,7 @@ private void InitializeOutput(int degreeOfParallelism, ParseResult parseResult, AnsiMode ansiMode = AnsiMode.AnsiIfPossible; // In LLM environments, prefer simple text output so that LLM can parse it easily. - // Note that NoAnsi also implies also no progress. + // Note that NoAnsi also implies no progress. if (noAnsi || new LLMEnvironmentDetectorForTelemetry().IsLLMEnvironment()) { // User explicitly specified --no-ansi.