Skip to content

Commit df59854

Browse files
authored
chore: ignore GitHub Codespaces BROWSER env var (#3068)
1 parent c0693a2 commit df59854

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Playwright.TestAdapter/PlaywrightSettingsProvider.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ public static string BrowserName
4040
get
4141
{
4242
var browserFromEnv = Environment.GetEnvironmentVariable("BROWSER")?.ToLowerInvariant();
43-
if (!string.IsNullOrEmpty(browserFromEnv))
43+
// GitHub Codespaces sets the BROWSER environment variable, ignore it if its bogus.
44+
var ignoreValueFromEnv = Environment.GetEnvironmentVariable("CODESPACES") == "true" && browserFromEnv!.StartsWith("/vscode/");
45+
if (!string.IsNullOrEmpty(browserFromEnv) && !ignoreValueFromEnv)
4446
{
4547
ValidateBrowserName(browserFromEnv!, "'BROWSER' environment variable", "\nTry to remove 'BROWSER' environment variable for using default browser");
4648
return browserFromEnv!;

0 commit comments

Comments
 (0)