Skip to content

Commit f3aae40

Browse files
CopilotYoussef1313
andauthored
dotnet test doesn't forward build command line options correctly (#50084)
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Youssef1313 <[email protected]>
1 parent 248fbc7 commit f3aae40

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/Cli/dotnet/Commands/Test/TestCommandParser.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ private static Command GetVSTestCliCommand()
293293
command.Options.Add(VerbosityOption);
294294
command.Options.Add(CommonOptions.ArchitectureOption);
295295
command.Options.Add(CommonOptions.OperatingSystemOption);
296+
command.Options.Add(CommonOptions.PropertiesOption);
296297
command.Options.Add(CommonOptions.DisableBuildServersOption);
297298
command.Options.Add(VsTestTargetOption);
298299
command.SetAction(TestCommand.Run);

test/dotnet.Tests/CommandTests/Test/TestCommandParserTests.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#nullable disable
55

6+
using System.CommandLine;
67
using Microsoft.DotNet.Cli.Commands.Test;
78

89
namespace Microsoft.DotNet.Cli.Test.Tests
@@ -60,5 +61,18 @@ public void SurroundWithDoubleQuotesHandlesCorrectlyOddCountOfTrailingBackslashe
6061
var result = TestCommandParser.SurroundWithDoubleQuotes(input);
6162
result.Should().Be("\"" + input + "\\\"");
6263
}
64+
65+
[Fact]
66+
public void VSTestCommandIncludesPropertiesOption()
67+
{
68+
var command = TestCommandParser.GetCommand();
69+
70+
// Verify that the command includes a property option that supports the /p alias
71+
var propertyOption = command.Options.FirstOrDefault(o =>
72+
o.Aliases.Contains("/p") || o.Aliases.Contains("--property"));
73+
74+
propertyOption.Should().NotBeNull("VSTest command should include CommonOptions.PropertiesOption to support /p Property=Value syntax");
75+
propertyOption.Aliases.Should().Contain("/p", "PropertiesOption should include /p alias for MSBuild compatibility");
76+
}
6377
}
6478
}

0 commit comments

Comments
 (0)