Skip to content

Commit

Permalink
passing correct test
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Jul 2, 2024
1 parent 371c6fe commit 412a974
Show file tree
Hide file tree
Showing 4 changed files with 246 additions and 396 deletions.
4 changes: 2 additions & 2 deletions packages/plugins/rrweb-plugin-console-record/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ function initLogObserver(
return (...args: Array<unknown>) => {
original.apply(this, args);

if (level === 'assert' && !args[0]) {
// assert does not log if the first argument evaluates to false
if (level === 'assert' && !!args[0]) {
// assert does not log if the first argument evaluates to true
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,10 @@ exports[`rrweb-plugin-console-record > should record console messages 1`] = `
\\"payload\\": {
\\"level\\": \\"assert\\",
\\"trace\\": [
\\"__puppeteer_evaluation_script__:2:15\\"
\\"__puppeteer_evaluation_script__:3:15\\"
],
\\"payload\\": [
\\"\\\\\\"assert\\\\\\"\\"
\\"\\\\\\"should log assert\\\\\\"\\"
]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ describe('rrweb-plugin-console-record', () => {
await page.goto(`${serverUrl}test/html/log.html`);

await page.evaluate(() => {
// truthy assert does log
console.assert(0 === 0, 'assert');
// falsy assert does not log
console.assert(false, 'assert');
// truthy assert does not log
console.assert(0 === 0, 'should not log assert');
// falsy assert does log
console.assert(false, 'should log assert');
console.count('count');
console.countReset('count');
console.debug('debug');
Expand Down
Loading

0 comments on commit 412a974

Please sign in to comment.