-
-
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
Fixed toHaveProperty returning false positives when looking for undefined property #8923
Fixed toHaveProperty returning false positives when looking for undefined property #8923
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Codecov Report
@@ Coverage Diff @@
## master #8923 +/- ##
==========================================
- Coverage 64.29% 64.28% -0.01%
==========================================
Files 276 276
Lines 11707 11702 -5
Branches 2864 2863 -1
==========================================
- Hits 7527 7523 -4
Misses 3549 3549
+ Partials 631 630 -1
Continue to review full report at Codecov.
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Output now reflects new output format: "<dim>expect(</><red>received</><dim>).</>toHaveProperty<dim>(</><green>path</><dim>, </><green>value</><dim>)</>
Expected path: <green>\\"a.b\\"</>
Received path: <red>\\"a\\"</>
Expected value: <green>undefined</>
Received value: <red>{}</>" |
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.
Thank you! I'll leave this for @pedrottimark as he's the master of expect
, but it LGTM 🙂
Thank you. I need to take a more careful look at the new |
Whoops. Forgot to take out that comment in |
@SimenB Is this an example of breaking change that we are postponing until Jest 26 milestone to maximize the number of people who can get the perf improvements in Jest 25? |
@pedrottimark yea, I think so |
@pedrottimark is this good to go you think? |
@SixTfour would you be up for rebasing this? 🙂 |
@SixTfour sorry for the long wait here. Would you mind rebasing this PR one more time? |
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.
thanks!
sorry about the delay 😅
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. |
Summary
Fix false positives when looking for undefined prop.
{a:{}}.hasProperty('b', undefined)
now returnsfalse
.More info can be found here.
Fixes #8786
Test plan
Used commented test on line 1380 in
packages/expect/src/__tests__/matchers.test.js
.