Skip to content

Commit cd740a2

Browse files
ljharbtargos
authored andcommitted
test: assert: fix deepStrictEqual comparing a real array and fake array
PR-URL: #30743 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 3ac40b9 commit cd740a2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/parallel/test-assert-deep.js

+15
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,21 @@ assert.throws(
10501050
assert.deepStrictEqual(a, b);
10511051
}
10521052

1053+
// Verify that an array and the equivalent fake array object
1054+
// are correctly compared
1055+
{
1056+
const a = [1, 2, 3];
1057+
const o = {
1058+
__proto__: Array.prototype,
1059+
0: 1,
1060+
1: 2,
1061+
2: 3,
1062+
length: 3,
1063+
};
1064+
Object.defineProperty(o, 'length', { enumerable: false });
1065+
assertNotDeepOrStrict(o, a);
1066+
}
1067+
10531068
// Verify that extra keys will be tested for when using fake arrays.
10541069
{
10551070
const a = {

0 commit comments

Comments
 (0)