From 2007706715dfef86310e6f08d55c85b4fe715440 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Fri, 20 Sep 2024 05:40:55 -0700 Subject: [PATCH] [test] Use JS string templates in test/browser_reporting.js. NFC --- test/browser_reporting.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/browser_reporting.js b/test/browser_reporting.js index 44e0941eb9112..897eed8ea2ecb 100644 --- a/test/browser_reporting.js +++ b/test/browser_reporting.js @@ -7,14 +7,14 @@ function reportResultToServer(result, port) { port = port || 8888; if (reportResultToServer.reported) { // Only report one result per test, even if the test misbehaves and tries to report more. - reportErrorToServer("excessive reported results, sending " + result + ", test will fail"); + reportErrorToServer(`excessive reported results, sending ${result}, test will fail`); } reportResultToServer.reported = true; if ((typeof ENVIRONMENT_IS_NODE !== 'undefined' && ENVIRONMENT_IS_NODE) || (typeof ENVIRONMENT_IS_AUDIO_WORKLET !== 'undefined' && ENVIRONMENT_IS_AUDIO_WORKLET)) { - out('RESULT: ' + result); + out(`RESULT: ${result}`); } else { let doFetch = typeof origFetch != 'undefined' ? origFetch : fetch; - doFetch('http://localhost:' + port + '/report_result?' + result).then(() => { + doFetch(`http://localhost:${port}/report_result?${result}`).then(() => { if (typeof window === 'object' && window && hasModule && !Module['pageThrewException']) { /* for easy debugging, don't close window on failure */ window.close(); @@ -35,7 +35,7 @@ function reportErrorToServer(message) { if (typeof ENVIRONMENT_IS_NODE !== 'undefined' && ENVIRONMENT_IS_NODE) { err(message); } else { - fetch(encodeURI('http://localhost:8888?stderr=' + message)); + fetch(encodeURI(`http://localhost:8888?stderr=${message}`)); } } @@ -43,7 +43,7 @@ function report_error(e) { // MINIMAL_RUNTIME doesn't handle exit or call the below onExit handler // so we detect the exit by parsing the uncaught exception message. var message = e.message || e; - console.error("got top level error: " + message); + console.error(`got top level error: ${message}`); if (window.disableErrorReporting) return; if (message.includes('unwind')) return; var offset = message.indexOf('exit('); @@ -52,10 +52,10 @@ function report_error(e) { offset = status.indexOf(')') status = status.substr(0, offset) console.error(status); - var result = 'exit:' + status; + var result = `exit:${status}`; } else { if (hasModule) Module['pageThrewException'] = true; - result = 'exception:' + message + ' / ' + e.stack; + result = `exception:${message} / ${e.stack}`; } // FIXME: Ideally we would just reportResultToServer rather than the `maybe` // form but some browser tests currently report exceptions after exit. @@ -75,7 +75,7 @@ if (hasModule) { // If Module['REPORT_EXIT'] is set to false, do not report the result of // onExit. if (Module['REPORT_EXIT'] !== false) { - maybeReportResultToServer('exit:' + status); + maybeReportResultToServer(`exit:${status}`); } } // Force these handlers to be proxied back to the main thread. @@ -87,7 +87,7 @@ if (hasModule) { if (!Module['onAbort']) { Module['onAbort'] = function(reason) { - maybeReportResultToServer('abort:' + reason); + maybeReportResultToServer(`abort:${reason}`); } Module['onAbort'].proxy = true; }