-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
toStrictEqual
does not cover sparse arrays
#7586
Comments
@emilsjolander (contributed |
Agreed, this was an oversight |
@marcfallows sounds like a nicely isolated bug for a first Jest PR :) |
PR raised: #7591 |
…estjs#7591) * fix: toStrictEqual considers array sparseness (resolves jestjs#7586) * changelog * review feedback * line in docs
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I'm getting what I consider unexpected behaviour for
toStrictEqual
, treating sparse arrays incorrectly:I would expect this assertion to fail.
While in terms of index access it seems these arrays are equivalent (because
[,1][0] === undefined
), sparse arrays do behave differently:This can also be seen as follows:
And so I don't think it's appropriate to consider these strictly equal.
Happy to contribute a fix, but just want to verify that this would be something you agree is a bug.
The text was updated successfully, but these errors were encountered: