Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/internal/util/comparisons.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ function strictDeepEqual(val1, val2, memos) {
const val1Value = val1.valueOf();
// Note: Boxed string keys are going to be compared again by Object.keys
if (val1Value !== val1) {
if (typeof val2.valueOf !== 'function') {
return false;
}
if (!innerDeepEqual(val1Value, val2.valueOf(), true))
return false;
// Fast path for boxed primitives
Expand Down
7 changes: 7 additions & 0 deletions test/parallel/test-assert-deep.js
Original file line number Diff line number Diff line change
Expand Up @@ -890,3 +890,10 @@ assert.deepStrictEqual(obj1, obj2);
);
util.inspect.defaultOptions = tmp;
}

// Basic valueOf check.
{
const a = new String(1);
a.valueOf = undefined;
assertNotDeepOrStrict(a, new String(1));
}