-
-
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
Check _isMockFunction is true rather than truthy on global properties #7017
Conversation
e651ed3
to
a851e42
Compare
Codecov Report
@@ Coverage Diff @@
## master #7017 +/- ##
==========================================
+ Coverage 66.95% 66.95% +<.01%
==========================================
Files 250 250
Lines 10430 10428 -2
Branches 4 4
==========================================
- Hits 6983 6982 -1
+ Misses 3446 3445 -1
Partials 1 1
Continue to review full report at Codecov.
|
Mind fixing the ones in https://github.com/facebook/jest/blob/0418cab88c5e927c94a02ecb445fc694e6b2bbda/packages/jest-mock/src/index.js#L729-L731 as well? Also, an integration test would be sweet 🙂 |
a851e42
to
328b16a
Compare
@SimenB thanks for having a look. I've updated the other instances of |
You can add an e2e test that uses Look in https://github.com/facebook/jest/tree/master/e2e - all directories are "projects" which you can run with |
df27bd3
to
213dbd8
Compare
213dbd8
to
7e0ad40
Compare
@SimenB Thanks, I've added an e2e test and rebased |
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!
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 #7009
Summary
resetModules
checks if_isMockFunction
is truthy on all properties of the global object, which can lead to TypeErrors when a global property is mocked usingidentity-obj-proxy
. Changing the condition to check if_isMockFunction
is true rather than truthy will fix the issue and keep the original intent of the code, so it shouldn't cause any breaking changes.Test plan
Tests all ran OK.