Skip to content

Commit 36ebee6

Browse files
committed
fixup! assert,util: fix constructor lookup in deep equal comparison
1 parent 3eda481 commit 36ebee6

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

test/parallel/test-assert-deep.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1579,11 +1579,25 @@ test('Own property constructor properties should check against the original prot
15791579
const b = { constructor: { name: 'Foo' } };
15801580
assertDeepAndStrictEqual(a, b);
15811581

1582-
const prototype = {};
1582+
let prototype = {};
15831583
Object.setPrototypeOf(a, prototype);
15841584
Object.setPrototypeOf(b, prototype);
15851585
assertDeepAndStrictEqual(a, b);
15861586

15871587
Object.setPrototypeOf(b, {});
15881588
assertNotDeepOrStrict(a, {});
1589+
1590+
prototype = { __proto__: null };
1591+
Object.setPrototypeOf(a, prototype);
1592+
Object.setPrototypeOf(b, prototype);
1593+
assertDeepAndStrictEqual(a, b);
1594+
1595+
Object.setPrototypeOf(b, { __proto__: null });
1596+
assert.notDeepStrictEqual(a, b);
1597+
assert.notDeepStrictEqual(b, a);
1598+
1599+
// Turn off no-restricted-properties because we are testing deepEqual!
1600+
/* eslint-disable no-restricted-properties */
1601+
assert.deepEqual(a, b);
1602+
assert.deepEqual(b, a);
15891603
});

0 commit comments

Comments
 (0)