-
-
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
Fix: expect
no longer tries to equal non-enumerable symbolic properties.…
#6398
Conversation
expect
no longer tries to equal non-enumerable symbolic properties.…expect
no longer tries to equal non-enumerable symbolic properties.…
return keys.concat((Object.getOwnPropertySymbols(o): Array<any>)); | ||
return keys.concat( | ||
(Object.getOwnPropertySymbols(o): Array<any>).filter( | ||
//$FlowFixMe Jest complains about nullability, but we know for sure that property 'symbol' does exist. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably mistyped in Flow libdefs. Would be great to send them a PR with a fix, but I have never done it yet, so I won't recommend anything 😅 cc @cpojer who is Flow expert recently ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Codecov Report
@@ Coverage Diff @@
## master #6398 +/- ##
=======================================
Coverage 63.48% 63.48%
=======================================
Files 227 227
Lines 8697 8697
Branches 4 3 -1
=======================================
Hits 5521 5521
Misses 3175 3175
Partials 1 1 Continue to review full report at Codecov.
|
This Pull Request updates dependency [jest](https://github.com/facebook/jest) from `v23.1.0` to `v23.2.0` <details> <summary>Release Notes</summary> ### [`v23.2.0`](https://github.com/facebook/jest/blob/master/CHANGELOG.md#​2320) [Compare Source](jestjs/jest@v23.1.0...v23.2.0) ##### Features - `[jest-each]` Add support for keyPaths in test titles ([#​6457](`https://github.com/facebook/jest/pull/6457`)) - `[jest-cli]` Add `jest --init` option that generates a basic configuration file with a short description for each option ([#​6442](`https://github.com/facebook/jest/pull/6442`)) - `[jest.retryTimes]` Add `jest.retryTimes()` option that allows failed tests to be retried n-times when using jest-circus. ([#​6498](`https://github.com/facebook/jest/pull/6498`)) ##### Fixes - `[jest-cli]` Add check to make sure one or more tests have run before notifying when using `--notify` ([#​6495](`https://github.com/facebook/jest/pull/6495`)) - `[jest-cli]` Pass `globalConfig` as a parameter to `globalSetup` and `globalTeardown` functions ([#​6486](`https://github.com/facebook/jest/pull/6486`)) - `[jest-config]` Add missing options to the `defaults` object ([#​6428](`https://github.com/facebook/jest/pull/6428`)) - `[expect]` Using symbolic property names in arrays no longer causes the `toEqual` matcher to fail ([#​6391](`https://github.com/facebook/jest/pull/6391`)) - `[expect]` `toEqual` no longer tries to compare non-enumerable symbolic properties, to be consistent with non-symbolic properties. ([#​6398](`https://github.com/facebook/jest/pull/6398`)) - `[jest-util]` `console.timeEnd` now properly log elapsed time in milliseconds. ([#​6456](`https://github.com/facebook/jest/pull/6456`)) - `[jest-mock]` Fix `MockNativeMethods` access in react-native `jest.mock()` ([#​6505](`https://github.com/facebook/jest/pull/6505`)) ##### Chore & Maintenance - `[docs]` Add jest-each docs for 1 dimensional arrays ([#​6444](`https://github.com/facebook/jest/pull/6444`/files)) --- </details> --- This PR has been generated by [Renovate Bot](https://renovatebot.com).
Probably related to jestjs/jest#6398
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. |
… Fixes #6392
Summary
See #6392. Non-enumerable members are not compared when using the
toEquals
matcher. However, if the non-enumerable member is symbolic, it is still used for comparison. Which results in failing equality checks with non visible difference.Note: it could be considered a separate bug that enumerable members declared on the prototype are considered for equality, while symbolic members on the prototype are not considered for equality (only ownSymbols are iterated), but I didn't change that in this MR to not fix two different bugs in one PR
Test plan
See unit test in the PR. Before this PR the first test would succeed and the second one fail. After this PR both will succeed.