From f7248e971f60282b4156d6f746cc7c85b496d8e4 Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Tue, 7 May 2024 11:52:27 +0100 Subject: [PATCH] fix: test for skipped browser warnings early (#661) Some browser warning logs are skipped - moves the test for the skipable warnings earlier in the method as they aren't skipped if valid message args are extracted from the message. --- src/utils/index.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/utils/index.js b/src/utils/index.js index 5f8663bf..9c269d7c 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -260,6 +260,17 @@ export async function redirectConsole(msg) { return } const text = msg.text() + + // skip browser informational warnings + if ( + text?.includes( + 'Synchronous XMLHttpRequest on the main thread is deprecated' + ) || + text?.includes('Clear-Site-Data') + ) { + return + } + // const { url, lineNumber, columnNumber } = msg.location() let msgArgs @@ -274,14 +285,6 @@ export async function redirectConsole(msg) { if (msgArgs && msgArgs.length > 0) { consoleFn.apply(console, msgArgs) } else if (text) { - if ( - text.includes( - 'Synchronous XMLHttpRequest on the main thread is deprecated' - ) || - text.includes('Clear-Site-Data') - ) { - return - } console.error(kleur.dim(`🌐${text}`)) } }