diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/index-headless.html b/crates/cli/src/bin/wasm-bindgen-test-runner/index-headless.html index d671a205..8f66a52e 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/index-headless.html +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/index-headless.html @@ -13,24 +13,30 @@ logs.innerHTML += `${msg}\n`; } }; + const orig_console_error = function(...args) { const logs = document.getElementById('console_error'); for (let msg of args) { logs.innerHTML += `${msg}\n`; } }; + console.log = function(...args) { - if (window.console_log_redirect) - window.console_log_redirect(orig_console_log, args); - else - orig_console_log.apply(this, args); + if (window.console_log_redirect) { + window.console_log_redirect(args); + } + + orig_console_log.apply(this, args); }; + console.error = function(...args) { - if (window.console_error_redirect) - window.console_error_redirect(orig_console_error, args); - else - orig_console_error.apply(this, args); + if (window.console_error_redirect) { + window.console_error_redirect(args); + } + + orig_console_error.apply(this, args); }; + window.__wbg_test_invoke = f => f(); diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/index.html b/crates/cli/src/bin/wasm-bindgen-test-runner/index.html index 073f5ec5..1709af62 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/index.html +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/index.html @@ -7,17 +7,21 @@