Repository navigation
Support --nologo in Microsoft.Testing.Platform test mode - #55376
Conversation
Recognize the common no-logo aliases in the Microsoft.Testing.Platform dotnet test command and translate them to MTP's --no-banner option. Add coverage for argument routing, DOTNET_NOLOGO, help output, and surfacing invalid child options. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 20c78411-66f5-4a42-a00d-2e719b93721b
|
Azure Pipelines: Successfully started running 1 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
This PR fixes dotnet test behavior when running in Microsoft.Testing.Platform (MTP) mode by recognizing common --nologo spellings and translating them to MTP’s --no-banner, preventing test apps from failing pre-discovery due to an unrecognized option.
Changes:
- Add
--no-logo/--nologo/-nologo//nologosupport to the MTPdotnet testparser and map it to--no-bannerfor test application invocation (including honoringDOTNET_NOLOGO). - Update MTP help snapshot output to include the new
-nologo, --no-logooption. - Add tests covering translation, de-duplication with explicit
--no-banner, env var behavior, and surfacing pre-handshake CLI errors from the child app.
Show a summary per file
| File | Description |
|---|---|
| test/dotnet.Tests/CommandTests/Test/TestCommandParserTests.cs | Adds parser/build-options tests for --nologo aliases, --no-banner de-duplication, and DOTNET_NOLOGO. |
| test/dotnet.Tests/CommandTests/Test/snapshots/MTPHelpSnapshotTests.VerifyMTPHelpOutput.verified.txt | Updates verified help output to include the new -nologo, --no-logo option. |
| test/dotnet.Tests/CommandTests/Test/GivenDotnetTestRunsConsoleAppWithoutHandshake.cs | Adds an end-to-end test asserting child pre-handshake invalid-option stderr is surfaced in SDK output. |
| src/Cli/Microsoft.DotNet.Cli.Definitions/Common/CommonOptions.cs | Allows CreateNoLogoOption to be created without forwarding (supports MTP mapping behavior). |
| src/Cli/Microsoft.DotNet.Cli.Definitions/Commands/Test/TestCommandDefinition.MicrosoftTestingPlatform.cs | Defines and registers NoLogoOption in the MTP test command. |
| src/Cli/dotnet/Commands/Test/MTP/MSBuildUtility.cs | Translates parsed NoLogoOption to --no-banner in test application args (avoids duplicates). |
Copilot's findings
- Files reviewed: 6/6 changed files
- Comments generated: 1
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 20c78411-66f5-4a42-a00d-2e719b93721b
Qualify System.Console so the dynamically replaced Program.cs builds without implicit usings on Helix. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 20c78411-66f5-4a42-a00d-2e719b93721b
|
/ba-g #55408 |
| -v, -verbosity <LEVEL> Set the MSBuild verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]. | ||
| --no-restore Do not restore the project before building. [default: False] | ||
| --no-build Do not build the project before testing. Implies --no-restore. [default: False] | ||
| -nologo, --no-logo Run test(s), without displaying Microsoft Testplatform banner [default: False] |
There was a problem hiding this comment.
is no banner a hidden option? why is it not listed in the help?
|
/backport to release/11.0.1xx-preview7 |
|
Started backporting to |
|
/backport to release/11.0.1xx-preview7 |
|
Started backporting to |
|
@Evangelink backporting to git am output$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Support --nologo in MTP test mode
Using index info to reconstruct a base tree...
M src/Cli/Microsoft.DotNet.Cli.Definitions/Commands/Test/TestCommandDefinition.MicrosoftTestingPlatform.cs
M src/Cli/Microsoft.DotNet.Cli.Definitions/Common/CommonOptions.cs
M src/Cli/dotnet/Commands/Test/MTP/MSBuildUtility.cs
M test/dotnet.Tests/CommandTests/Test/GivenDotnetTestRunsConsoleAppWithoutHandshake.cs
M test/dotnet.Tests/CommandTests/Test/TestCommandParserTests.cs
M test/dotnet.Tests/CommandTests/Test/snapshots/MTPHelpSnapshotTests.VerifyMTPHelpOutput.verified.txt
Falling back to patching base and 3-way merge...
Auto-merging src/Cli/dotnet/Commands/Test/MTP/MSBuildUtility.cs
Auto-merging test/dotnet.Tests/CommandTests/Test/GivenDotnetTestRunsConsoleAppWithoutHandshake.cs
CONFLICT (content): Merge conflict in test/dotnet.Tests/CommandTests/Test/GivenDotnetTestRunsConsoleAppWithoutHandshake.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Support --nologo in MTP test mode
Error: The process '/usr/bin/git' failed with exit code 128 |
| -v, -verbosity <LEVEL> Set the MSBuild verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]. | ||
| --no-restore Do not restore the project before building. [default: False] | ||
| --no-build Do not build the project before testing. Implies --no-restore. [default: False] | ||
| -nologo, --no-logo Run test(s), without displaying Microsoft Testplatform banner [default: False] |
There was a problem hiding this comment.
Microsoft.Testing.Platform?
Fixes #55309.
Summary
When
dotnet testuses Microsoft.Testing.Platform,--nologois currently treated as an unmatched extension option and forwarded unchanged to each test application. MTP recognizes--no-bannerinstead, so it exits with code 5 before test discovery.This change:
--no-logo,--nologo,-nologo, and/nologoaliases in MTP mode--no-bannerDOTNET_NOLOGOwhile preserving the default behavior when it is unset--no-bannerUnknown options must continue to flow through because MTP extensions dynamically contribute command-line options; the SDK cannot reject them during its initial parse. The SDK's existing handshake-failure path on
maincaptures and reports the child application's actionable stderr. That diagnostic improvement should also be considered for backport to .NET 10, where the reported opaque output occurs.Validation
src/Cli/dotnet/dotnet.csprojTestCommandDefinitionTests--nologobecomes--no-bannerand is not forwarded to MSBuild