Skip to content

Skip all dotnet-watch tests on non-Windows platforms #49336

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

Merged
merged 2 commits into from
Jun 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions test/dotnet-watch.Tests/Aspire/AspireServiceFactoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Microsoft.DotNet.Watch.UnitTests;

public class AspireServiceFactoryTests
{
[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void GetRunCommandArguments_Empty()
{
var request = new ProjectLaunchRequest()
Expand All @@ -24,7 +24,7 @@ public void GetRunCommandArguments_Empty()
AssertEx.SequenceEqual(["--project", "a.csproj"], args);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void GetRunCommandArguments_DisableLaunchProfile()
{
var request = new ProjectLaunchRequest()
Expand All @@ -41,7 +41,7 @@ public void GetRunCommandArguments_DisableLaunchProfile()
AssertEx.SequenceEqual(["--project", "a.csproj", "--no-launch-profile" ], args);
}

[Theory]
[PlatformSpecificTheory(TestPlatforms.Windows)] // https://github.com/dotnet/sdk/issues/49307
[InlineData("")]
[InlineData(null)]
public void GetRunCommandArguments_NoLaunchProfile_HostProfile(string? launchProfile)
Expand All @@ -60,7 +60,7 @@ public void GetRunCommandArguments_NoLaunchProfile_HostProfile(string? launchPro
AssertEx.SequenceEqual(["--project", "a.csproj", "--launch-profile", "H"], args);
}

[Theory]
[PlatformSpecificTheory(TestPlatforms.Windows)] // https://github.com/dotnet/sdk/issues/49307
[InlineData("")]
[InlineData(null)]
public void GetRunCommandArguments_DisableLaunchProfile_HostProfile(string? launchProfile)
Expand All @@ -79,7 +79,7 @@ public void GetRunCommandArguments_DisableLaunchProfile_HostProfile(string? laun
AssertEx.SequenceEqual(["--project", "a.csproj", "--no-launch-profile"], args);
}

[Theory]
[PlatformSpecificTheory(TestPlatforms.Windows)] // https://github.com/dotnet/sdk/issues/49307
[InlineData("")]
[InlineData(null)]
public void GetRunCommandArguments_NoLaunchProfile_NoHostProfile(string? launchProfile)
Expand All @@ -97,7 +97,7 @@ public void GetRunCommandArguments_NoLaunchProfile_NoHostProfile(string? launchP

AssertEx.SequenceEqual(["--project", "a.csproj"], args);
}
[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void GetRunCommandArguments_LaunchProfile_NoArgs()
{
var request = new ProjectLaunchRequest()
Expand All @@ -114,7 +114,7 @@ public void GetRunCommandArguments_LaunchProfile_NoArgs()
AssertEx.SequenceEqual(["--project", "a.csproj", "--launch-profile", "P"], args);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void GetRunCommandArguments_LaunchProfile_EmptyArgs()
{
var request = new ProjectLaunchRequest()
Expand All @@ -131,7 +131,7 @@ public void GetRunCommandArguments_LaunchProfile_EmptyArgs()
AssertEx.SequenceEqual(["--project", "a.csproj", "--launch-profile", "P", "--no-launch-profile-arguments"], args);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void GetRunCommandArguments_LaunchProfile_NonEmptyArgs()
{
var request = new ProjectLaunchRequest()
Expand Down
2 changes: 1 addition & 1 deletion test/dotnet-watch.Tests/Browser/BrowserConnectorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Microsoft.DotNet.Watch.UnitTests;

public class BrowserConnectorTests
{
[Theory]
[PlatformSpecificTheory(TestPlatforms.Windows)] // https://github.com/dotnet/sdk/issues/49307
[InlineData(null, "https://localhost:1234", "https://localhost:1234")]
[InlineData(null, "https://localhost:1234/", "https://localhost:1234/")]
[InlineData("", "https://localhost:1234", "https://localhost:1234")]
Expand Down
68 changes: 34 additions & 34 deletions test/dotnet-watch.Tests/CommandLineOptionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private void VerifyErrors(string[] args, params string[] expectedErrors)
Assert.NotEqual(0, errorCode);
}

[Theory]
[PlatformSpecificTheory(TestPlatforms.Windows)] // https://github.com/dotnet/sdk/issues/49307
[InlineData([new[] { "-h" }])]
[InlineData([new[] { "-?" }])]
[InlineData([new[] { "--help" }])]
Expand All @@ -55,7 +55,7 @@ public void HelpArgs(string[] args)
Assert.Contains("Usage:", output.ToString());
}

[Theory]
[PlatformSpecificTheory(TestPlatforms.Windows)] // https://github.com/dotnet/sdk/issues/49307
[InlineData("-p:P=V", "P", "V")]
[InlineData("-p:P==", "P", "=")]
[InlineData("-p:P=A=B", "P", "A=B")]
Expand All @@ -67,7 +67,7 @@ public void BuildProperties_Valid(string argValue, string name, string value)
AssertEx.SequenceEqual([(name, value)], properties);
}

[Theory]
[PlatformSpecificTheory(TestPlatforms.Windows)] // https://github.com/dotnet/sdk/issues/49307
[InlineData("P")]
[InlineData("=P3")]
[InlineData("=")]
Expand All @@ -78,15 +78,15 @@ public void BuildProperties_Invalid(string argValue)
AssertEx.SequenceEqual([], properties);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void ImplicitCommand()
{
var options = VerifyOptions([]);
Assert.Equal("run", options.Command);
AssertEx.SequenceEqual([InteractiveOption], options.CommandArguments);
}

[Theory]
[PlatformSpecificTheory(TestPlatforms.Windows)] // https://github.com/dotnet/sdk/issues/49307
[InlineData("add")]
[InlineData("build")]
[InlineData("build-server")]
Expand Down Expand Up @@ -119,7 +119,7 @@ public void ExplicitCommand(string command)
Assert.Empty(args);
}

[Theory]
[PlatformSpecificTheory(TestPlatforms.Windows)] // https://github.com/dotnet/sdk/issues/49307
[CombinatorialData]
public void WatchOptions_NotPassedThrough_BeforeCommand(
[CombinatorialValues("--quiet", "--verbose", "--no-hot-reload", "--non-interactive")] string option,
Expand All @@ -130,7 +130,7 @@ public void WatchOptions_NotPassedThrough_BeforeCommand(
AssertEx.SequenceEqual(option == "--non-interactive" ? [] : [InteractiveOption], options.CommandArguments);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void RunOptions_LaunchProfile_Watch()
{
var options = VerifyOptions(["-lp", "P", "run"]);
Expand All @@ -139,7 +139,7 @@ public void RunOptions_LaunchProfile_Watch()
AssertEx.SequenceEqual(["-lp", "P", InteractiveOption], options.CommandArguments);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void RunOptions_LaunchProfile_Run()
{
var options = VerifyOptions(["run", "-lp", "P"]);
Expand All @@ -148,14 +148,14 @@ public void RunOptions_LaunchProfile_Run()
AssertEx.SequenceEqual(["-lp", "P", InteractiveOption], options.CommandArguments);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void RunOptions_LaunchProfile_Both()
{
VerifyErrors(["-lp", "P1", "run", "-lp", "P2"],
"error ❌ Option '-lp' expects a single argument but 2 were provided.");
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void RunOptions_NoProfile_Watch()
{
var options = VerifyOptions(["--no-launch-profile", "run"]);
Expand All @@ -165,7 +165,7 @@ public void RunOptions_NoProfile_Watch()
AssertEx.SequenceEqual(["--no-launch-profile", InteractiveOption], options.CommandArguments);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void RunOptions_NoProfile_Run()
{
var options = VerifyOptions(["run", "--no-launch-profile"]);
Expand All @@ -175,7 +175,7 @@ public void RunOptions_NoProfile_Run()
AssertEx.SequenceEqual(["--no-launch-profile", InteractiveOption], options.CommandArguments);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void RunOptions_NoProfile_Both()
{
var options = VerifyOptions(["--no-launch-profile", "run", "--no-launch-profile"]);
Expand All @@ -185,7 +185,7 @@ public void RunOptions_NoProfile_Both()
AssertEx.SequenceEqual(["--no-launch-profile", InteractiveOption], options.CommandArguments);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void RemainingOptions()
{
var options = VerifyOptions(["-watchArg", "--verbose", "run", "-runArg"]);
Expand All @@ -195,7 +195,7 @@ public void RemainingOptions()
AssertEx.SequenceEqual([InteractiveOption, "-watchArg", "-runArg"], options.CommandArguments);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void UnknownOption()
{
var options = VerifyOptions(["--verbose", "--unknown", "x", "y", "run", "--project", "p"]);
Expand All @@ -205,7 +205,7 @@ public void UnknownOption()
AssertEx.SequenceEqual(["--project", "p", InteractiveOption, "--unknown", "x", "y"], options.CommandArguments);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void RemainingOptionsDashDash()
{
var options = VerifyOptions(["-watchArg", "--", "--verbose", "run", "-runArg"]);
Expand All @@ -215,7 +215,7 @@ public void RemainingOptionsDashDash()
AssertEx.SequenceEqual([InteractiveOption, "-watchArg", "--", "--verbose", "run", "-runArg",], options.CommandArguments);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void RemainingOptionsDashDashRun()
{
var options = VerifyOptions(["--", "run"]);
Expand All @@ -225,7 +225,7 @@ public void RemainingOptionsDashDashRun()
AssertEx.SequenceEqual([InteractiveOption, "--", "run"], options.CommandArguments);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void NoOptionsAfterDashDash()
{
var options = VerifyOptions(["--"]);
Expand All @@ -240,7 +240,7 @@ public void NoOptionsAfterDashDash()
/// Therfore, it has to also be ignored by `dotnet run`,
/// otherwise the TFMs would be inconsistent between `dotnet watch` and `dotnet run`.
/// </summary>
[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void ParsedNonWatchOptionsAfterDashDash_Framework()
{
var options = VerifyOptions(["--", "-f", "TFM"]);
Expand All @@ -249,7 +249,7 @@ public void ParsedNonWatchOptionsAfterDashDash_Framework()
AssertEx.SequenceEqual([InteractiveOption, "--", "-f", "TFM"], options.CommandArguments);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void ParsedNonWatchOptionsAfterDashDash_Project()
{
var options = VerifyOptions(["--", "--project", "proj"]);
Expand All @@ -258,7 +258,7 @@ public void ParsedNonWatchOptionsAfterDashDash_Project()
AssertEx.SequenceEqual([InteractiveOption, "--", "--project", "proj"], options.CommandArguments);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void ParsedNonWatchOptionsAfterDashDash_NoLaunchProfile()
{
var options = VerifyOptions(["--", "--no-launch-profile"]);
Expand All @@ -267,7 +267,7 @@ public void ParsedNonWatchOptionsAfterDashDash_NoLaunchProfile()
AssertEx.SequenceEqual([InteractiveOption, "--", "--no-launch-profile"], options.CommandArguments);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void ParsedNonWatchOptionsAfterDashDash_LaunchProfile()
{
var options = VerifyOptions(["--", "--launch-profile", "p"]);
Expand All @@ -276,7 +276,7 @@ public void ParsedNonWatchOptionsAfterDashDash_LaunchProfile()
AssertEx.SequenceEqual([InteractiveOption, "--", "--launch-profile", "p"], options.CommandArguments);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void ParsedNonWatchOptionsAfterDashDash_Property()
{
var options = VerifyOptions(["--", "--property", "x=1"]);
Expand All @@ -285,7 +285,7 @@ public void ParsedNonWatchOptionsAfterDashDash_Property()
AssertEx.SequenceEqual([InteractiveOption, "--", "--property", "x=1"], options.CommandArguments);
}

[Theory]
[PlatformSpecificTheory(TestPlatforms.Windows)] // https://github.com/dotnet/sdk/issues/49307
[CombinatorialData]
public void OptionsSpecifiedBeforeOrAfterRun(bool afterRun)
{
Expand All @@ -307,7 +307,7 @@ public enum ArgPosition
Both
}

[Theory]
[PlatformSpecificTheory(TestPlatforms.Windows)] // https://github.com/dotnet/sdk/issues/49307
[CombinatorialData]
public void OptionDuplicates_Allowed_Bool(
ArgPosition position,
Expand Down Expand Up @@ -342,7 +342,7 @@ public void OptionDuplicates_Allowed_Bool(
});
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void MultiplePropertyValues()
{
var options = VerifyOptions(["--property", "P1=V1", "run", "--property", "P2=V2"]);
Expand All @@ -352,7 +352,7 @@ public void MultiplePropertyValues()
AssertEx.SequenceEqual(["--property:P1=V1", "--property:P2=V2", InteractiveOption], options.CommandArguments);
}

[Theory]
[PlatformSpecificTheory(TestPlatforms.Windows)] // https://github.com/dotnet/sdk/issues/49307
[InlineData("--project")]
[InlineData("--framework")]
public void OptionDuplicates_NotAllowed(string option)
Expand All @@ -361,7 +361,7 @@ public void OptionDuplicates_NotAllowed(string option)
$"error ❌ Option '{option}' expects a single argument but 2 were provided.");
}

[Theory]
[PlatformSpecificTheory(TestPlatforms.Windows)] // https://github.com/dotnet/sdk/issues/49307
[InlineData(new[] { "--unrecognized-arg" }, new[] { InteractiveOption, "--unrecognized-arg" })]
[InlineData(new[] { "run" }, new string[] { InteractiveOption })]
[InlineData(new[] { "run", "--", "runarg" }, new[] { InteractiveOption, "--", "runarg" })]
Expand All @@ -376,14 +376,14 @@ public void ParsesRemainingArgs(string[] args, string[] expected)
Assert.Equal(expected, options.CommandArguments);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void CannotHaveQuietAndVerbose()
{
VerifyErrors(["--quiet", "--verbose"],
$"error ❌ {Resources.Error_QuietAndVerboseSpecified}");
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void ShortFormForProjectArgumentPrintsWarning()
{
var options = VerifyOptions(["-p", "MyProject.csproj"],
Expand All @@ -392,22 +392,22 @@ public void ShortFormForProjectArgumentPrintsWarning()
Assert.Equal("MyProject.csproj", options.ProjectPath);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void LongFormForProjectArgumentWorks()
{
var options = VerifyOptions(["--project", "MyProject.csproj"]);
Assert.Equal("MyProject.csproj", options.ProjectPath);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void LongFormForLaunchProfileArgumentWorks()
{
var options = VerifyOptions(["--launch-profile", "CustomLaunchProfile"]);
Assert.NotNull(options);
Assert.Equal("CustomLaunchProfile", options.LaunchProfileName);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void ShortFormForLaunchProfileArgumentWorks()
{
var options = VerifyOptions(["-lp", "CustomLaunchProfile"]);
Expand All @@ -419,7 +419,7 @@ public void ShortFormForLaunchProfileArgumentWorks()
/// <summary>
/// Validates that options that the "run" command forwards to "build" command are forwarded by dotnet-watch.
/// </summary>
[Theory]
[PlatformSpecificTheory(TestPlatforms.Windows)] // https://github.com/dotnet/sdk/issues/49307
[InlineData(new[] { "--configuration", "release" }, new[] { "-property:Configuration=release", NugetInteractiveProperty })]
[InlineData(new[] { "--framework", "net9.0" }, new[] { "-property:TargetFramework=net9.0", NugetInteractiveProperty })]
[InlineData(new[] { "--runtime", "arm64" }, new[] { "-property:RuntimeIdentifier=arm64", "-property:_CommandLineDefinedRuntimeIdentifier=true", NugetInteractiveProperty })]
Expand All @@ -438,7 +438,7 @@ public void ForwardedBuildOptions(string[] args, string[] buildArgs)
AssertEx.SequenceEqual(buildArgs, options.BuildArguments);
}

[Fact]
[PlatformSpecificFact(TestPlatforms.Windows)] // "https://github.com/dotnet/sdk/issues/49307")
public void ForwardedBuildOptions_ArtifactsPath()
{
var path = TestContext.Current.TestAssetsDirectory;
Expand Down
Loading
Loading