Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: config.webServer.command cannot be empty (#37136)
Simon Knottcb6be94000a3
diff --git a/packages/playwright/src/plugins/webServerPlugin.ts b/packages/playwright/src/plugins/webServerPlugin.tsindex afd067c855..bdbcfe3d0c 100644--- a/packages/playwright/src/plugins/webServerPlugin.ts+++ b/packages/playwright/src/plugins/webServerPlugin.ts@@ -94,6 +94,9 @@ export class WebServerPlugin implements TestRunnerPlugin {throw new Error(`${this._options.url ?? `http://localhost${port ? ':' + port : ''}`} is already used, make sure that nothing is running on the port/url or set reuseExistingServer:true in config.webServer.`);}+ if (!this._options.command)+ throw new Error('config.webServer.command cannot be empty');+debugWebServer(`Starting WebServer process ${this._options.command}...`);const { launchedProcess, gracefullyClose } = await launchProcess({command: this._options.command,diff --git a/tests/playwright-test/web-server.spec.ts b/tests/playwright-test/web-server.spec.tsindex 9260012105..52c541de45 100644--- a/tests/playwright-test/web-server.spec.ts+++ b/tests/playwright-test/web-server.spec.ts@@ -864,3 +864,24 @@ test.describe('name option', () => {expect(result.output).toContain(`[${defaultPrefix}]`);});});++test('should throw helpful error when command is empty', async ({ runInlineTest }) => {+ const result = await runInlineTest({+ 'test.spec.ts': `+ import { test, expect } from '@playwright/test';+ test('pass', async ({}) => {});+ `,+ 'playwright.config.ts': `+ module.exports = {+ webServer: [+ {+ command: '',+ url: 'http://localhost:3000',+ }+ ],+ };+ `,+ }, undefined);+ expect(result.exitCode).toBe(1);+ expect(result.output).toContain('config.webServer.command cannot be empty');+});