From 446790024d879c2f574944f908e8e697971d5c32 Mon Sep 17 00:00:00 2001 From: Hong Gu Date: Fri, 22 Nov 2024 21:02:47 -0600 Subject: [PATCH] Add a closure of the callback function for page.evaluate Without this closure, this may occur with browser fixture created from extending test Error: page.evaluate: TypeError: callbacks.set is not a function at :24:64 at new Promise () at globalThis. (:24:21) at eval (eval at evaluate (:234:30), :2:16) at UtilityScript.evaluate (:236:17) at UtilityScript. (:1:44) Signed-off-by: Hong Gu --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 23c1e07..093a809 100644 --- a/index.js +++ b/index.js @@ -31,9 +31,9 @@ const test = baseTest.extend({ }); await use(context); for (const page of context.pages()) { - await page.evaluate(() => - window.collectIstanbulCoverage(JSON.stringify(window.__coverage__)), - ); + await page.evaluate(() => { + window.collectIstanbulCoverage(JSON.stringify(window.__coverage__)); + }); } }, });