From aca98023d93d02c00bb5f3df213025876339e530 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Thu, 3 Apr 2025 19:01:14 +0200 Subject: [PATCH] Mark APIs not supported in wasi --- .../Microsoft.Testing.Extensions.HotReload/HotReloadHandler.cs | 1 + .../Microsoft.Testing.Platform.csproj | 1 + .../OutputDevice/BrowserOutputDevice.cs | 1 + .../OutputDevice/OutputDeviceManager.cs | 2 +- .../OutputDevice/Terminal/NonAnsiTerminal.cs | 1 + .../Services/CTRLPlusCCancellationTokenSource.cs | 1 + 6 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Platform/Microsoft.Testing.Extensions.HotReload/HotReloadHandler.cs b/src/Platform/Microsoft.Testing.Extensions.HotReload/HotReloadHandler.cs index d9e3980e2d..281048572a 100644 --- a/src/Platform/Microsoft.Testing.Extensions.HotReload/HotReloadHandler.cs +++ b/src/Platform/Microsoft.Testing.Extensions.HotReload/HotReloadHandler.cs @@ -51,6 +51,7 @@ private static bool IsCancelKeyPressNotSupported() => RuntimeInformation.IsOSPlatform(OSPlatform.Create("ANDROID")) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS")) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("TVOS")) || + RuntimeInformation.IsOSPlatform(OSPlatform.Create("WASI")) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER")); // Called automatically by the runtime through the MetadataUpdateHandlerAttribute diff --git a/src/Platform/Microsoft.Testing.Platform/Microsoft.Testing.Platform.csproj b/src/Platform/Microsoft.Testing.Platform/Microsoft.Testing.Platform.csproj index 13ce520dbb..bd28670a15 100644 --- a/src/Platform/Microsoft.Testing.Platform/Microsoft.Testing.Platform.csproj +++ b/src/Platform/Microsoft.Testing.Platform/Microsoft.Testing.Platform.csproj @@ -85,6 +85,7 @@ This package provides the core platform and the .NET implementation of the proto + diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/BrowserOutputDevice.cs b/src/Platform/Microsoft.Testing.Platform/OutputDevice/BrowserOutputDevice.cs index b2a3213f34..e215879c04 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/BrowserOutputDevice.cs +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/BrowserOutputDevice.cs @@ -21,6 +21,7 @@ namespace Microsoft.Testing.Platform.OutputDevice; /// Implementation of output device that writes to terminal with progress and optionally with ANSI. /// [SupportedOSPlatform("browser")] +[SupportedOSPlatform("wasi")] internal sealed partial class BrowserOutputDevice : IPlatformOutputDevice, IDataConsumer, IOutputDeviceDataProducer, diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/OutputDeviceManager.cs b/src/Platform/Microsoft.Testing.Platform/OutputDevice/OutputDeviceManager.cs index e446ea7794..87ae5097ea 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/OutputDeviceManager.cs +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/OutputDeviceManager.cs @@ -41,7 +41,7 @@ internal async Task BuildAsync(ServiceProvider serviceProvide } public static IPlatformOutputDevice GetDefaultTerminalOutputDevice(ServiceProvider serviceProvider) - => RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER")) + => RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER")) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("WASI")) ? new BrowserOutputDevice( serviceProvider.GetConsole(), serviceProvider.GetTestApplicationModuleInfo(), diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/NonAnsiTerminal.cs b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/NonAnsiTerminal.cs index b23d0d4104..11af53dc1e 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/NonAnsiTerminal.cs +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/NonAnsiTerminal.cs @@ -275,5 +275,6 @@ private static bool IsForegroundColorNotSupported() => RuntimeInformation.IsOSPlatform(OSPlatform.Create("ANDROID")) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS")) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("TVOS")) || + RuntimeInformation.IsOSPlatform(OSPlatform.Create("WASI")) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER")); } diff --git a/src/Platform/Microsoft.Testing.Platform/Services/CTRLPlusCCancellationTokenSource.cs b/src/Platform/Microsoft.Testing.Platform/Services/CTRLPlusCCancellationTokenSource.cs index 796b1e09b2..3521080157 100644 --- a/src/Platform/Microsoft.Testing.Platform/Services/CTRLPlusCCancellationTokenSource.cs +++ b/src/Platform/Microsoft.Testing.Platform/Services/CTRLPlusCCancellationTokenSource.cs @@ -29,6 +29,7 @@ private static bool IsCancelKeyPressNotSupported() => RuntimeInformation.IsOSPlatform(OSPlatform.Create("ANDROID")) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS")) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("TVOS")) || + RuntimeInformation.IsOSPlatform(OSPlatform.Create("WASI")) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER")); public void CancelAfter(TimeSpan timeout) => _cancellationTokenSource.CancelAfter(timeout);