[TS] Fix CI when we log while the browser is shutting down
authorMatt Corallo <git@bluematt.me>
Wed, 2 Feb 2022 19:29:45 +0000 (19:29 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 2 Feb 2022 19:31:01 +0000 (19:31 +0000)
ts/test/browser.mjs

index 5f65191a3bb7df5d221a9d21bdd1eb5d31281620..e4e6112cbc88c065b162d38245b7508e17493d97 100644 (file)
@@ -10,10 +10,12 @@ for (const browserType of [chromium, firefox]) { // We'd like to test webkit, bu
        const context = await browser.newContext();
        const page = await context.newPage();
        page.on('console', async msg => {
-               const values = [];
-               for (const arg of msg.args())
-                       values.push(await arg.jsonValue());
-               console.log(...values);
+               try {
+                       const values = [];
+                       for (const arg of msg.args())
+                               values.push(await arg.jsonValue());
+                       console.log(...values);
+               } catch (_) { /* sometimes this gets hit if we're logging while the browser shuts down */ }
        });
        await page.goto('http://localhost:8000/test/index.html');
        var ret;