From fccb2b078423b9edf09f86ff8afe0c43df64900a Mon Sep 17 00:00:00 2001 From: Adam Gastineau Date: Fri, 24 Jan 2025 14:21:42 -0800 Subject: [PATCH] chore: fix codegen SIGINT test (#34468) --- tests/library/inspector/cli-codegen-2.spec.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/library/inspector/cli-codegen-2.spec.ts b/tests/library/inspector/cli-codegen-2.spec.ts index 205bbbae5e..6419a6999c 100644 --- a/tests/library/inspector/cli-codegen-2.spec.ts +++ b/tests/library/inspector/cli-codegen-2.spec.ts @@ -459,8 +459,13 @@ await page1.GotoAsync("about:blank?foo");`); const cli = runCLI([`--save-storage=${storageFileName}`, `--save-har=${harFileName}`]); await cli.waitFor(`import { test, expect } from '@playwright/test'`); await cli.process.kill('SIGINT'); - const { exitCode } = await cli.process.exited; - expect(exitCode).toBe(130); + const { exitCode, signal } = await cli.process.exited; + if (exitCode !== null) { + expect(exitCode).toBe(130); + } else { + // If the runner is slow enough, the process will be forcibly terminated by the signal + expect(signal).toBe('SIGINT'); + } expect(fs.existsSync(storageFileName)).toBeTruthy(); expect(fs.existsSync(harFileName)).toBeTruthy(); });