add exception
This commit is contained in:
parent
a156cfe451
commit
970fad07e7
|
|
@ -101,6 +101,8 @@ export class WebServerPlugin implements TestRunnerPlugin {
|
||||||
timeout = this._options.kill.SIGINT;
|
timeout = this._options.kill.SIGINT;
|
||||||
}
|
}
|
||||||
if ('SIGTERM' in this._options.kill && typeof this._options.kill.SIGTERM === 'number') {
|
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';
|
signal = 'SIGTERM';
|
||||||
timeout = this._options.kill.SIGTERM;
|
timeout = this._options.kill.SIGTERM;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -804,4 +804,11 @@ test.describe('kill option', () => {
|
||||||
|
|
||||||
expect(testProcess.outputLines({ prefix: '[WebServer] ' })).toEqual(['webserver received SIGINT but stubbornly refuses to wind down']);
|
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');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue