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

toStrictEqual does not consider arrays with objects having undefined values correctly #7937

Closed
dubzzz opened this issue Feb 19, 2019 · 1 comment · Fixed by #7938
Closed

Comments

@dubzzz
Copy link
Contributor

dubzzz commented Feb 19, 2019

💥 Regression Report

toStrictEqual does not consider arrays with objects having undefined values correctly.

Starting at 24.0.0, [{a: undefined}] is strict equal to [{}] - while {a: undefined} and {} are not strict equal.

Last working version

Worked up to version: 23.6.0

Stopped working in version: 24.0.0

To Reproduce

Steps to reproduce the behavior:

// Fails starting at 24.0.0
expect([{a: undefined}]).not.toStrictEqual([{}]);

// While the following is still true
expect({a: undefined}).not.toStrictEqual({});

Expected behavior

The following assertion should not fail:

expect([{a: undefined}]).not.toStrictEqual([{}]);

Indeed {a: undefined} is not {}.

Run npx envinfo --preset jest

Paste the results here:

$ npx envinfo --preset jest
npx : 1 installé(s) en 4.679s

  System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
  Binaries:
    Node: 10.12.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.10.1 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.7.0 - C:\Program Files\nodejs\npm.CMD
dubzzz added a commit to dubzzz/fast-check that referenced this issue Feb 19, 2019
Seems that there is a regression on Jest:
jestjs/jest#7937
dubzzz added a commit to dubzzz/jest that referenced this issue Feb 19, 2019
dubzzz added a commit to dubzzz/jest that referenced this issue Feb 19, 2019
dubzzz added a commit to dubzzz/jest that referenced this issue Feb 20, 2019
thymikee pushed a commit that referenced this issue Feb 20, 2019
…d values correctly (#7938)

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory. -->

<!-- Please remember to update CHANGELOG.md in the root of the project if you have not done so. -->

## Summary

Fixes #7937: `toStrictEqual` does not consider arrays with objects having undefined values correctly

## Test plan

Before that change, the following assertion was failing:

```js
expect([{a: undefined}]).not.toStrictEqual([{}]);
```

Now it passes as expected.
@github-actions
Copy link

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.
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 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant