diff --git a/packages/playwright/src/plugins/webServerPlugin.ts b/packages/playwright/src/plugins/webServerPlugin.ts index 58b6033f36..5c2451521c 100644 --- a/packages/playwright/src/plugins/webServerPlugin.ts +++ b/packages/playwright/src/plugins/webServerPlugin.ts @@ -30,7 +30,7 @@ export type WebServerPluginOptions = { url?: string; ignoreHTTPSErrors?: boolean; timeout?: number; - kill?: { SIGINT: number }|{ SIGTERM: number }; + kill?: { SIGINT?: number, SIGTERM?: number }; reuseExistingServer?: boolean; cwd?: string; env?: { [key: string]: string; }; @@ -95,11 +95,11 @@ export class WebServerPlugin implements TestRunnerPlugin { let signal: 'SIGINT' | 'SIGTERM' | undefined = undefined; let timeout = 0; if (this._options.kill) { - if ('SIGINT' in this._options.kill && typeof this._options.kill.SIGINT === 'number') { + if (typeof this._options.kill.SIGINT === 'number') { signal = 'SIGINT'; timeout = this._options.kill.SIGINT; } - if ('SIGTERM' in this._options.kill && typeof this._options.kill.SIGTERM === 'number') { + if (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'; diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index 0af2f07dc5..0c33f8dadb 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -9378,9 +9378,9 @@ interface TestConfigWebServer { * and `SIGTERM` signals, so this option is ignored. */ kill?: { - SIGINT: number; + SIGINT?: number; - SIGTERM: number; + SIGTERM?: number; }; /**