Skip to content

Commit fb8bf4b

Browse files
committed
Fix FSharp test race condition
1 parent 6239f3e commit fb8bf4b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public async Task ChangeFileInFSharpProject()
8080

8181
UpdateSourceFile(Path.Combine(testAsset.Path, "Program.fs"), content => content.Replace("Hello World!", "<Updated>"));
8282

83-
await App.AssertOutputLineStartsWith("<Updated>");
83+
await App.WaitUntilOutputContains("<Updated>");
8484
}
8585

8686
[Fact]

test/dotnet-watch.Tests/Watch/Utilities/WatchableApp.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ public WatchableApp(ITestOutputHelper logger)
3737
public static string GetLinePrefix(MessageDescriptor descriptor)
3838
=> $"dotnet watch {descriptor.Emoji} {descriptor.Format}";
3939

40+
public async ValueTask WaitUntilOutputContains(string message)
41+
{
42+
if (!Process.Output.Any(line => line.Contains(message)))
43+
{
44+
_ = await AssertOutputLine(line => line.Contains(message));
45+
}
46+
}
47+
4048
public Task<string> AssertOutputLineStartsWith(MessageDescriptor descriptor, Predicate<string> failure = null)
4149
=> AssertOutputLineStartsWith(GetLinePrefix(descriptor), failure);
4250

0 commit comments

Comments
 (0)