fix: use JSON.stringify to cast console output

pull/28046/head^2
Valeriy 2019-02-27 00:15:28 +03:00 committed by Stuart Taylor
parent 43117710eb
commit 3f205c5060
2 changed files with 3 additions and 5 deletions

View File

@ -6,16 +6,14 @@ const oldLog = self.console.log.bind(self.console);
self.console.log = function proxyConsole(...args) {
self.postMessage({
type: 'LOG',
data: args.map(log => JSON.stringify(log)).join(' ')
data: args.map(arg => JSON.stringify(arg)).join(' ')
});
return oldLog(...args);
};
self.onmessage = async e => {
/* eslint-disable no-unused-vars */
const {
code = ''
} = e.data;
const { code = '' } = e.data;
const assert = chai.assert;
// Fake Deep Equal dependency
const DeepEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);

View File

@ -84,7 +84,7 @@ const mountFrame = document => ({ element, ...rest }) => {
const buildProxyConsole = proxyLogger => ctx => {
const oldLog = ctx.window.console.log.bind(ctx.window.console);
ctx.window.console.log = function proxyConsole(...args) {
proxyLogger(args);
proxyLogger(args.map(arg => JSON.stringify(arg)).join(' '));
return oldLog(...args);
};
return ctx;