Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cd740a2

Browse filesBrowse files
ljharbtargos
authored andcommitted
test: assert: fix deepStrictEqual comparing a real array and fake array
PR-URL: #30743 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 3ac40b9 commit cd740a2
Copy full SHA for cd740a2

File tree

Expand file treeCollapse file tree

1 file changed

+15
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+15
-0
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-assert-deep.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-assert-deep.js
+15Lines changed: 15 additions & 0 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.