Skip to content

Commit cac4688

Browse files
authored
[test] Use JS string templates in test/browser_reporting.js. NFC (#22599)
1 parent 8996d44 commit cac4688

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

test/browser_reporting.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ function reportResultToServer(result, port) {
77
port = port || 8888;
88
if (reportResultToServer.reported) {
99
// Only report one result per test, even if the test misbehaves and tries to report more.
10-
reportErrorToServer("excessive reported results, sending " + result + ", test will fail");
10+
reportErrorToServer(`excessive reported results, sending ${result}, test will fail`);
1111
}
1212
reportResultToServer.reported = true;
1313
if ((typeof ENVIRONMENT_IS_NODE !== 'undefined' && ENVIRONMENT_IS_NODE) || (typeof ENVIRONMENT_IS_AUDIO_WORKLET !== 'undefined' && ENVIRONMENT_IS_AUDIO_WORKLET)) {
14-
out('RESULT: ' + result);
14+
out(`RESULT: ${result}`);
1515
} else {
1616
let doFetch = typeof origFetch != 'undefined' ? origFetch : fetch;
17-
doFetch('http://localhost:' + port + '/report_result?' + result).then(() => {
17+
doFetch(`http://localhost:${port}/report_result?${result}`).then(() => {
1818
if (typeof window === 'object' && window && hasModule && !Module['pageThrewException']) {
1919
/* for easy debugging, don't close window on failure */
2020
window.close();
@@ -35,15 +35,15 @@ function reportErrorToServer(message) {
3535
if (typeof ENVIRONMENT_IS_NODE !== 'undefined' && ENVIRONMENT_IS_NODE) {
3636
err(message);
3737
} else {
38-
fetch(encodeURI('http://localhost:8888?stderr=' + message));
38+
fetch(encodeURI(`http://localhost:8888?stderr=${message}`));
3939
}
4040
}
4141

4242
function report_error(e) {
4343
// MINIMAL_RUNTIME doesn't handle exit or call the below onExit handler
4444
// so we detect the exit by parsing the uncaught exception message.
4545
var message = e.message || e;
46-
console.error("got top level error: " + message);
46+
console.error(`got top level error: ${message}`);
4747
if (window.disableErrorReporting) return;
4848
if (message.includes('unwind')) return;
4949
var offset = message.indexOf('exit(');
@@ -52,10 +52,10 @@ function report_error(e) {
5252
offset = status.indexOf(')')
5353
status = status.substr(0, offset)
5454
console.error(status);
55-
var result = 'exit:' + status;
55+
var result = `exit:${status}`;
5656
} else {
5757
if (hasModule) Module['pageThrewException'] = true;
58-
result = 'exception:' + message + ' / ' + e.stack;
58+
result = `exception:${message} / ${e.stack}`;
5959
}
6060
// FIXME: Ideally we would just reportResultToServer rather than the `maybe`
6161
// form but some browser tests currently report exceptions after exit.
@@ -75,7 +75,7 @@ if (hasModule) {
7575
// If Module['REPORT_EXIT'] is set to false, do not report the result of
7676
// onExit.
7777
if (Module['REPORT_EXIT'] !== false) {
78-
maybeReportResultToServer('exit:' + status);
78+
maybeReportResultToServer(`exit:${status}`);
7979
}
8080
}
8181
// Force these handlers to be proxied back to the main thread.
@@ -87,7 +87,7 @@ if (hasModule) {
8787

8888
if (!Module['onAbort']) {
8989
Module['onAbort'] = function(reason) {
90-
maybeReportResultToServer('abort:' + reason);
90+
maybeReportResultToServer(`abort:${reason}`);
9191
}
9292
Module['onAbort'].proxy = true;
9393
}

0 commit comments

Comments
 (0)