fix(test-runner): throw error if no port and url is given (#20497)

https://github.com/microsoft/playwright/issues/20476
This commit is contained in:
Max Schmitt 2023-01-30 16:28:31 +01:00 committed by GitHub
parent f72d400952
commit 01790c0e19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -210,7 +210,7 @@ export const webServerPluginsForConfig = (config: FullConfigInternal): TestRunne
const shouldSetBaseUrl = !!config.webServer;
const webServerPlugins = [];
for (const webServerConfig of config._webServers) {
if (webServerConfig.port !== undefined && webServerConfig.url !== undefined)
if ((!webServerConfig.port && !webServerConfig.url) || (webServerConfig.port && webServerConfig.url))
throw new Error(`Exactly one of 'port' or 'url' is required in config.webServer.`);
const url = webServerConfig.url || `http://localhost:${webServerConfig.port}`;