diff --git a/karma.conf.js b/karma.conf.js index 5765906c62..70fd26e40e 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -16,7 +16,9 @@ const fs = require('fs').promises; const orgStdoutWrite = process.stdout.write; process.stdout.write = msg => { let out = ''; - const match = msg.match(/(^|.*\s)(LOG|WARN|ERROR):\s'([\s\S]*)'/); + const match = msg.match( + /(^|.*\s)(LOG|WARN|ERROR):\s'__LOG_CUSTOM:([\S\s]*)'/ + ); if (match && match.length >= 4) { // Sometimes the UA of the browser will be included in the message if (match[1].length) { @@ -29,6 +31,8 @@ process.stdout.write = msg => { out += match[3]; } out += '\n'; + } else if (/(^|.*\s)(LOG|WARN|ERROR):\s([\S\s]*)/.test(msg)) { + // Nothing } else { out = msg; } diff --git a/test/polyfills.js b/test/polyfills.js index 1484dace75..e2f542b9f9 100644 --- a/test/polyfills.js +++ b/test/polyfills.js @@ -80,7 +80,7 @@ function patchConsole(method) { window.console[method] = (...args) => { // @ts-ignore // eslint-disable-next-line no-undef - __karma__.log(method, serializeConsoleArgs(args)); + __karma__.log(method, ['__LOG_CUSTOM:' + serializeConsoleArgs(args)]); original.apply(window.console, args); }; } @@ -197,6 +197,10 @@ function serialize(value, mode, indent, seen) { return kl.cyan(`[Function: ${value.name || 'anonymous'}]`); } + if (value instanceof Element) { + return value.outerHTML; + } + seen.add(value); const props = Object.keys(value).map(key => { @@ -253,3 +257,4 @@ function serialize(value, mode, indent, seen) { // new Set([1, 2]), // new Map([[1, 2]]) // ); +// console.log(document.createElement('div'));