-
-
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
toMatchObject throws TypeError when a source property is null #6313
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 [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
packages/expect/src/utils.js
Outdated
@@ -206,6 +206,8 @@ export const subsetEquality = (object: Object, subset: Object) => { | |||
|
|||
return Object.keys(subset).every( | |||
key => | |||
object !== null && |
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.
can do just object != null
for both at once
CHANGELOG.md
Outdated
@@ -7,6 +7,7 @@ | |||
|
|||
### Fixes | |||
|
|||
* `[expect]` toMatchObject throws TypeError when a source property is null ([#6313](https://github.com/facebook/jest/pull/6313)) |
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.
If you rebase, this should go under master
(23.0.1 has been released)
Codecov Report
@@ Coverage Diff @@
## master #6313 +/- ##
==========================================
+ Coverage 63.65% 63.67% +0.02%
==========================================
Files 227 226 -1
Lines 8637 8634 -3
Branches 3 3
==========================================
Hits 5498 5498
+ Misses 3138 3135 -3
Partials 1 1
Continue to review full report at Codecov.
|
Mind rebasing/merging master? |
Done. |
* upstream/master: normalize icons and slashes across OSes (jestjs#6310) fix: toMatchObject throws TypeError when a source property is null (jestjs#6313)
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
This fixes the issue brought up in #6235
This code above gives a TypeError as opposed to a nice assertion error.
Test plan
Added a few tests for the subsetEqulity function.
I've signed the CLA.