fix: open 0.0.0.0 as localhost (#29054)

Fixes https://github.com/microsoft/playwright/issues/29047
This commit is contained in:
Max Schmitt 2024-01-18 22:21:49 +01:00 committed by GitHub
parent b5e766e99e
commit 4a45724633
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -168,7 +168,7 @@ export async function openTraceInBrowser(traceUrls: string[], options?: OpenTrac
// eslint-disable-next-line no-console
console.log('\nListening on ' + url);
if (!isUnderTest())
await open(url).catch(() => {});
await open(url.replace('0.0.0.0', 'localhost')).catch(() => {});
}
class StdinServer implements Transport {

View File

@ -181,6 +181,7 @@ export async function showHTMLReport(reportFolder: string | undefined, host: str
console.log(colors.cyan(` Serving HTML report at ${url}. Press Ctrl+C to quit.`));
if (testId)
url += `#?testId=${testId}`;
url = url.replace('0.0.0.0', 'localhost');
await open(url, { wait: true }).catch(() => {});
await new Promise(() => {});
}