diff --git a/packages/playwright-test/src/plugins/webServerPlugin.ts b/packages/playwright-test/src/plugins/webServerPlugin.ts index 85eedd2c6c..67ead61ae6 100644 --- a/packages/playwright-test/src/plugins/webServerPlugin.ts +++ b/packages/playwright-test/src/plugins/webServerPlugin.ts @@ -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}`;