diff --git a/packages/playwright/src/plugins/webServerPlugin.ts b/packages/playwright/src/plugins/webServerPlugin.ts index 5eda8ee822..0af0b90bbf 100644 --- a/packages/playwright/src/plugins/webServerPlugin.ts +++ b/packages/playwright/src/plugins/webServerPlugin.ts @@ -101,6 +101,8 @@ export class WebServerPlugin implements TestRunnerPlugin { timeout = this._options.kill.SIGINT; } if ('SIGTERM' in this._options.kill && typeof this._options.kill.SIGTERM === 'number') { + if (signal) + throw new Error('Only one of SIGINT or SIGTERM can be specified in config.webServer.kill'); signal = 'SIGTERM'; timeout = this._options.kill.SIGTERM; } diff --git a/tests/playwright-test/web-server.spec.ts b/tests/playwright-test/web-server.spec.ts index f3c3d772f0..e5e42f2643 100644 --- a/tests/playwright-test/web-server.spec.ts +++ b/tests/playwright-test/web-server.spec.ts @@ -804,4 +804,11 @@ test.describe('kill option', () => { expect(testProcess.outputLines({ prefix: '[WebServer] ' })).toEqual(['webserver received SIGINT but stubbornly refuses to wind down']); }); + + test('throws when mixed', async ({ interactWithTestRunner }) => { + const testProcess = await interactWithTestRunner(files({ kill: { SIGINT: 500, SIGTERM: 500 } }), { workers: 1 }); + await testProcess.exited; + + expect(testProcess.output).toContain('Only one of SIGINT or SIGTERM can be specified in config.webServer.kill'); + }); });