fix: use JSON.stringify(..) for logging instead of String(..)
This commit is contained in:
committed by
Stuart Taylor
parent
b494eebcc5
commit
43117710eb
@ -4,13 +4,18 @@ import __toString from 'lodash/toString';
|
||||
|
||||
const oldLog = self.console.log.bind(self.console);
|
||||
self.console.log = function proxyConsole(...args) {
|
||||
self.postMessage({ type: 'LOG', data: String(args) });
|
||||
self.postMessage({
|
||||
type: 'LOG',
|
||||
data: args.map(log => JSON.stringify(log)).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);
|
||||
@ -35,7 +40,9 @@ self.onmessage = async e => {
|
||||
if (typeof testResult === 'function') {
|
||||
await testResult(fileName => __toString(e.data.sources[fileName]));
|
||||
}
|
||||
self.postMessage({ pass: true });
|
||||
self.postMessage({
|
||||
pass: true
|
||||
});
|
||||
} catch (err) {
|
||||
self.postMessage({
|
||||
err: {
|
||||
|
Reference in New Issue
Block a user