diff --git a/test/helpers.js b/test/helpers.js index 19cc7ef2b..6e38874f8 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -798,27 +798,39 @@ export async function setupBrowser() { ); }); page.on("requestfinished", async (req) => { + if (req.method() === "OPTION") { + return; + } + const resp = await req.response(); + let respText; try { - const resp = await req.response(); - const respText = req.url().startsWith(TEST_APPLICATION_SERVER_BASE_URL) + respText = req.url().startsWith(TEST_APPLICATION_SERVER_BASE_URL) ? await resp.text() : "response omitted"; - addLog( - `browserlog.network ${JSON.stringify({ - t: new Date().toISOString(), - message: `Request done: ${req.method()} ${req.url()}: ${resp.status()} ${respText}`, - pageurl: page.url(), - })}` - ); } catch (e) { - console.log("requestfinished err", req.url(), e); + respText = "response loading failed " + e.message; } + addLog( + `browserlog.network ${JSON.stringify({ + t: new Date().toISOString(), + message: `Request done: ${req.method()} ${req.url()}: ${resp.status()} ${respText}`, + pageurl: page.url(), + })}` + ); }); page.on("requestfailed", async (req) => { + if (req.method() === "OPTION") { + return; + } const resp = await req.response(); - const respText = req.url().startsWith(TEST_APPLICATION_SERVER_BASE_URL) - ? await resp.text() - : "response omitted"; + let respText; + try { + respText = req.url().startsWith(TEST_APPLICATION_SERVER_BASE_URL) + ? await resp.text() + : "response omitted"; + } catch (e) { + respText = "response loading failed " + e.message; + } addLog( `browserlog.network ${JSON.stringify({ t: new Date().toISOString(), diff --git a/test/server/utils.js b/test/server/utils.js index b568ff9ca..d0660d58f 100644 --- a/test/server/utils.js +++ b/test/server/utils.js @@ -20,8 +20,8 @@ let axios = require("axios").default; module.exports.executeCommand = async function (cmd) { return new Promise((resolve, reject) => { exec(cmd, (err, stdout, stderr) => { - console.log(err, stderr, stdout); if (err) { + console.log({ err }); reject(err); return; }