Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
29 changes: 26 additions & 3 deletions test/dotnet-watch.Tests/TestUtilities/WatchableApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ public async Task<string> AssertOutputLineStartsWith(string expectedPrefix, Pred
{
Logger.Log($"Test waiting for output: '{expectedPrefix}'", testPath, testLine);

var line = await Process.GetOutputLineAsync(
success: line => line.StartsWith(expectedPrefix, StringComparison.Ordinal),
failure: failure ?? new Predicate<string>(line => line.Contains(WatchErrorOutputEmoji, StringComparison.Ordinal)));
var line = await TryGetOutputLineWithDelayAsync(
expectedPrefix,
failure ?? new Predicate<string>(line => line.Contains(WatchErrorOutputEmoji, StringComparison.Ordinal)));

if (line == null)
{
Expand Down Expand Up @@ -171,5 +171,28 @@ public void SendKey(char c)
Process.Process.StandardInput.Write(c);
Process.Process.StandardInput.Flush();
}

private async Task<string> TryGetOutputLineWithDelayAsync(string expectedPrefix, Predicate<string> failure, int maxAttempts = 2)
{
for (int attempt = 0; attempt < maxAttempts; attempt++)
{
if (attempt > 0)
{
Logger.Log($"Retrying to find output with prefix: '{expectedPrefix}' (attempt {attempt + 1}/{maxAttempts})");
await Task.Delay(TimeSpan.FromSeconds(1));
}

var line = await Process.GetOutputLineAsync(
success: line => line.StartsWith(expectedPrefix, StringComparison.Ordinal),
failure: failure);

if (line is not null)
{
return line;
}
}

return null;
}
}
}
10 changes: 5 additions & 5 deletions test/dotnet-watch.Tests/Watch/GlobbingAppTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public GlobbingAppTests(ITestOutputHelper logger)
{
}

[ConditionalTheory(Skip = "https://github.com/dotnet/sdk/issues/42921")]
[ConditionalTheory]
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-enabling this test should include verification that the underlying issue #42921 has been resolved. Consider adding a comment explaining why the test is now safe to re-enable or what changes fixed the original problem.

Copilot generated this review using guidance from repository custom instructions.
[InlineData(true)]
[InlineData(false)]
public async Task ChangeCompiledFile(bool usePollingWatcher)
Expand All @@ -34,7 +34,7 @@ public async Task ChangeCompiledFile(bool usePollingWatcher)
await AssertCompiledAppDefinedTypes(expected: 2);
}

[Fact(Skip = "https://github.com/dotnet/sdk/issues/42921")]
[Fact]
public async Task DeleteCompiledFile()
{
var testAsset = TestAssets.CopyTestAsset(AppName)
Expand All @@ -51,7 +51,7 @@ public async Task DeleteCompiledFile()
await AssertCompiledAppDefinedTypes(expected: 1);
}

[Fact(Skip = "https://github.com/dotnet/sdk/issues/42921")]
[Fact]
public async Task DeleteSourceFolder()
{
var testAsset = TestAssets.CopyTestAsset(AppName)
Expand All @@ -68,7 +68,7 @@ public async Task DeleteSourceFolder()
await AssertCompiledAppDefinedTypes(expected: 1);
}

[Fact(Skip = "https://github.com/dotnet/sdk/issues/42921")]
[Fact]
public async Task RenameCompiledFile()
{
var testAsset = TestAssets.CopyTestAsset(AppName)
Expand All @@ -85,7 +85,7 @@ public async Task RenameCompiledFile()
await App.AssertStarted();
}

[Fact(Skip = "https://github.com/dotnet/sdk/issues/42921")]
[Fact]
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-enabling this test should include verification that the underlying issue #42921 has been resolved. Consider adding a comment explaining why the test is now safe to re-enable or what changes fixed the original problem.

Copilot generated this review using guidance from repository custom instructions.
public async Task ChangeExcludedFile()
{
var testAsset = TestAssets.CopyTestAsset(AppName)
Expand Down
2 changes: 1 addition & 1 deletion test/dotnet-watch.Tests/Watch/NoDepsAppTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class NoDepsAppTests(ITestOutputHelper logger) : DotNetWatchTestBase(logg
{
private const string AppName = "WatchNoDepsApp";

[Fact(Skip = "https://github.com/dotnet/sdk/issues/42921")]
[Fact]
public async Task RestartProcessOnFileChange()
{
var testAsset = TestAssets.CopyTestAsset(AppName)
Expand Down
Loading