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

fix: int keys ranging outside of [0, 4294967294] are ignored when comparing arrays together #11057

Merged
merged 4 commits into from
Feb 5, 2021

Conversation

dubzzz
Copy link
Contributor

@dubzzz dubzzz commented Feb 5, 2021

Summary

This Pull Request fixes #11056.

arr1 and arr2 are now said to be different in the code below:

test('should not pass', () => {
  const arr1 = [];
  arr1[4294967295] = 1;
  const arr2 = [];
  arr2[4294967295] = 2;
  expect(arr2).not.toEqual(arr1);
});

Test plan

Test added

@@ -0,0 +1,6 @@
test('inline snapshots', () =>
Copy link
Member

Choose a reason for hiding this comment

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

this file should not be checked in

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Woops, I may have miss clicked when adding the last commit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will update

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@@ -198,7 +198,7 @@ function keys(
isArray: boolean,
hasKey: (obj: object, key: string) => boolean,
) {
var allKeys = (function(o) {
var allKeys = (function (o) {
Copy link
Member

Choose a reason for hiding this comment

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

huh

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@SimenB SimenB changed the title Int keys ranging outside of [0, 4294967294] are ignored when comparing arrays together fix: int keys ranging outside of [0, 4294967294] are ignored when comparing arrays together Feb 5, 2021
@SimenB SimenB merged commit e11072b into jestjs:master Feb 5, 2021
slorber pushed a commit to jest-website-migration/jest that referenced this pull request Feb 11, 2021
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integer keys ranging outside of [0, 4294967294] are ignored when comparing arrays together
3 participants