Skip to content

Commit

Permalink
console plugin fix (rrweb-io#832)
Browse files Browse the repository at this point in the history
* fix: empty payload in console-plugin

* update unit test
  • Loading branch information
YunFeng0817 authored Feb 10, 2022
1 parent 81454ea commit 1935bf6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/rrweb/src/plugins/console/record/stringify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ export function stringify(
return value ? value.outerHTML : '';
}
return value.nodeName;
} else if (value instanceof Error) {
return value.name + ': ' + value.message;
}
return value;
});
Expand Down
15 changes: 15 additions & 0 deletions packages/rrweb/test/__snapshots__/integration.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7806,6 +7806,21 @@ exports[`record integration tests should record console messages 1`] = `
}
}
},
{
\\"type\\": 6,
\\"data\\": {
\\"plugin\\": \\"rrweb/console@1\\",
\\"payload\\": {
\\"level\\": \\"log\\",
\\"trace\\": [
\\"__puppeteer_evaluation_script__:19:37\\"
],
\\"payload\\": [
\\"\\\\\\"TypeError: a message\\\\\\"\\"
]
}
}
},
{
\\"type\\": 3,
\\"data\\": {
Expand Down
1 change: 1 addition & 0 deletions packages/rrweb/test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ describe('record integration tests', function (this: ISuite) {
console.trace('trace');
console.warn('warn');
console.clear();
console.log(new TypeError('a message'));
const iframe = document.createElement('iframe');
document.body.appendChild(iframe);
});
Expand Down

0 comments on commit 1935bf6

Please sign in to comment.