Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}
Expand Down
7 changes: 6 additions & 1 deletion test/polyfills.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
}
Expand Down Expand Up @@ -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 => {
Expand Down Expand Up @@ -253,3 +257,4 @@ function serialize(value, mode, indent, seen) {
// new Set([1, 2]),
// new Map([[1, 2]])
// );
// console.log(document.createElement('div'));