Skip to content

Commit

Permalink
testbench: prevent from circular structures or unserializable things …
Browse files Browse the repository at this point in the history
…in log overload
  • Loading branch information
tchakabam committed Jun 4, 2018
1 parent 65a3d9d commit d4d7b6b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/functional/auto/testbench.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ function setupConsoleLogRedirection () {
}

window.console[methodName] = function () {
append(methodName, Array.prototype.slice.call(arguments).map(JSON.stringify).join(' '));
append(methodName, Array.prototype.slice.call(arguments).map(function (arg) {
try {
return JSON.stringify(arg);
} catch (err) {
return 'Unserializable (reason: ' + err.message + ')';
}
}).join(' '));

return original.apply(this, arguments);
};
});
Expand Down

0 comments on commit d4d7b6b

Please sign in to comment.