Skip to content

Commit e7573f9

Browse files
committed
assert: don't compare object prototype property
All own enumerable properties are compared already. Comparing `prototype` property specifically can cause weird behaviour. PR-URL: #636 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 8d11799 commit e7573f9

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

lib/assert.js

-2
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,6 @@ function isArguments(object) {
186186
function objEquiv(a, b) {
187187
if (a === null || a === undefined || b === null || b === undefined)
188188
return false;
189-
// an identical 'prototype' property.
190-
if (a.prototype !== b.prototype) return false;
191189
// if one is a primitive, the other must be same
192190
if (util.isPrimitive(a) || util.isPrimitive(b))
193191
return a === b;

test/parallel/test-assert.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ assert.doesNotThrow(makeBlock(a.deepEqual, nb1, nb2));
130130

131131
nameBuilder2.prototype = Object;
132132
nb2 = new nameBuilder2('Ryan', 'Dahl');
133-
assert.throws(makeBlock(a.deepEqual, nb1, nb2), a.AssertionError);
133+
assert.doesNotThrow(makeBlock(a.deepEqual, nb1, nb2));
134134

135135
// primitives and object
136136
assert.throws(makeBlock(a.deepEqual, null, {}), a.AssertionError);

0 commit comments

Comments
 (0)