Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util: assert: fix deepStrictEqual comparing a real array and fake array #30743

Closed
wants to merge 1 commit into from
Closed
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
15 changes: 15 additions & 0 deletions test/parallel/test-assert-deep.js
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,21 @@ assert.throws(
assertDeepAndStrictEqual(a, b);
}

// Verify that an array and the equivalent fake array object
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test was previously passing, but it felt like a good addition anyways.

// are correctly compared
{
const a = [1, 2, 3];
const o = {
__proto__: Array.prototype,
0: 1,
1: 2,
2: 3,
length: 3,
};
Object.defineProperty(o, 'length', { enumerable: false });
assertNotDeepOrStrict(o, a);
}

// Verify that extra keys will be tested for when using fake arrays.
{
const a = {
Expand Down