From bdd83644a66fc781d0d7e1eb795b43c8dc3c9e93 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 29 Jan 2024 10:41:21 +0100 Subject: [PATCH] Add CONTINUE_ON_ERRORS test flag This allows when debugging tests to avoid that the test ends before having an opportunity to debug what really went wrong. --- tests/support/fixtures.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/support/fixtures.ts b/tests/support/fixtures.ts index 4f10c639b..2de54c406 100644 --- a/tests/support/fixtures.ts +++ b/tests/support/fixtures.ts @@ -57,12 +57,14 @@ export const test = base.extend<{ log(msg.text(), browserLabel, outputLog); }); - page.on("pageerror", msg => { - expect( - false, - `Test failed because there was a console error in the app: ${msg}`, - ).toBeTruthy(); - }); + if (!process.env.CONTINUE_ON_ERRORS) { + page.on("pageerror", msg => { + expect( + false, + `Test failed because there was a console error in the app: ${msg}`, + ).toBeTruthy(); + }); + } if (!customAppConfig) { // Remember: `page.addInitScript()` is run in the browser which