-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Implement global --config-file and --diagnostic-output-directory options for dotnet test MTP #50136
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
base: main
Are you sure you want to change the base?
Conversation
…ile, --diagnostic-output-directory, --timeout, --minimum-expected-tests, --maximum-failed-tests Co-authored-by: Youssef1313 <[email protected]>
…ling of absolute/relative paths Co-authored-by: Youssef1313 <[email protected]>
…nostic-output-directory Co-authored-by: Youssef1313 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements support for two new "global" command-line options in dotnet test
when using Microsoft Testing Platform (MTP): --config-file
and --diagnostic-output-directory
. These options are processed by the dotnet CLI and automatically converted to absolute paths before being forwarded to test applications.
Key changes:
- Added two new command-line options (
--config-file
and--diagnostic-output-directory
) that only appear when using Microsoft Testing Platform - Implemented path transformation logic that converts relative paths to absolute paths using
Path.GetFullPath()
- Updated data structures and argument forwarding to handle the new options
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/Cli/dotnet/Commands/CliCommandStrings.resx |
Added resource strings for the new command-line option descriptions and help names |
src/Cli/dotnet/Commands/xlf/*.xlf |
Updated localization files with new resource entries marked as "state=new" |
src/Cli/dotnet/Commands/Test/TestingPlatformOptions.cs |
Defined the two new command-line options with proper descriptions and arity |
src/Cli/dotnet/Commands/Test/TestCommandParser.cs |
Added the new options to the testing platform CLI command |
src/Cli/dotnet/Commands/Test/Options.cs |
Extended PathOptions record to include the new configuration file and diagnostic output directory paths |
src/Cli/dotnet/Commands/Test/MSBuildUtility.cs |
Implemented path transformation logic and updated PathOptions construction |
src/Cli/dotnet/Commands/Test/TestApplication.cs |
Added argument forwarding logic for the new options to test applications |
Comments suppressed due to low confidence (1)
@@ -565,6 +565,19 @@ This is equivalent to deleting project.assets.json.</value> | |||
<value>The directory where the test results will be placed. | |||
The specified directory will be created if it does not exist.</value> | |||
</data> | |||
<data name="CmdConfigFileDescription" xml:space="preserve"> | |||
<value>The NuGet configuration file to use for the test execution.</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Update the description to:
Specifies a testconfig.json file.
…tput-directory options Co-authored-by: Youssef1313 <[email protected]>
Co-authored-by: Youssef1313 <[email protected]>
This PR implements support for two "global" command-line options in
dotnet test
when using Microsoft Testing Platform (MTP). These options are processed by the dotnet CLI itself and properly transformed before being passed to individual test applications, rather than being blindly forwarded.New Options Added
The following options are now available when using Microsoft Testing Platform:
--config-file <CONFIG_FILE>
- The testconfig.json configuration file to use for test execution--diagnostic-output-directory <DIAGNOSTIC_DIR>
- Directory where diagnostic output will be placedImplementation Details
The implementation follows the same pattern established by the existing
--results-directory
option (from #50081):Path Transformation: Options that accept file/directory paths (
--config-file
,--diagnostic-output-directory
) are automatically converted from relative to absolute paths usingPath.GetFullPath()
based on the current working directory.Global Processing: These options are handled by the dotnet CLI and not included in the forwarded MSBuild arguments, ensuring they are processed consistently across all test projects.
Microsoft Testing Platform Only: The new options only appear when using Microsoft Testing Platform (determined by
dotnet.config
file with[dotnet.test.runner] name = Microsoft.Testing.Platform
). VSTest continues to work unchanged.Example Usage
In this example, if run from
/repo/root
, the relative paths are transformed to:--config-file /repo/root/path/to/testconfig.json
--diagnostic-output-directory /repo/root/diagnostics
--results-directory /repo/root/TestResults
This ensures that all test projects receive absolute paths pointing to the same directories relative to where
dotnet test
was invoked, regardless of the individual project locations.Testing
dotnet test --help
when using Microsoft Testing PlatformPart of #49709.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.