diff --git a/packages/playwright-test/src/reporters/html.ts b/packages/playwright-test/src/reporters/html.ts index 2768b4ccfa..4511c57f2e 100644 --- a/packages/playwright-test/src/reporters/html.ts +++ b/packages/playwright-test/src/reporters/html.ts @@ -177,7 +177,6 @@ export async function showHTMLReport(reportFolder: string | undefined, testId?: if (testId) url += `#?testId=${testId}`; open(url); - process.on('SIGINT', () => process.exit(0)); await new Promise(() => {}); } diff --git a/packages/playwright-test/src/runner.ts b/packages/playwright-test/src/runner.ts index 927016ef9b..8ba1263a23 100644 --- a/packages/playwright-test/src/runner.ts +++ b/packages/playwright-test/src/runner.ts @@ -290,6 +290,11 @@ export class Runner { if (!list) { const dispatcher = new Dispatcher(this._loader, testGroups, this._reporter); await Promise.race([dispatcher.run(), sigIntPromise]); + if (!sigint) { + // We know for sure there was no Ctrl+C, so we remove custom SIGINT handler + // as soon as we can. + process.off('SIGINT', sigintHandler); + } await dispatcher.stop(); hasWorkerErrors = dispatcher.hasWorkerErrors(); }