-
Notifications
You must be signed in to change notification settings - Fork 50
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
Mock not working #23
Comments
I have tested it with Node.js 9.2.0 and it's still happening. |
After doing some debugging, I think problem is due to jest-runtime implementing its own require() function that has its own cache object. Seems it's done in purposse to isolate the modules and prevent side-effects... that's in fact what's doing the mock. Is there any alternative to the mock overwritting the cache entry for |
|
The proposed advice works. Probably should it be added to the readme? |
Thanks for sharing this issue @piranna. Improving I appreciate your enthusiasm toward contributing. |
Note done :-) Thank you for your compliments, it's the first time I'm working with ReactNative and I'm doing some intensive tests on it the way I see it fit us better (I come from a Node.js backend background and for cleanness I try to do testing against only the public APIs), and this module is the only one that has offered us an almost real environment to do the tests on the full application once at all :-) It has some flaws too, but I like APIs development, so it's funny to complete the missing parts :-D |
On Node.js v8.9.1, seems that
require.cache
is per module andmock.js
script side effects are not working. I've done some traces both onmock.js
and mysetupTests.js
file (that calls the first one) and they are different:Am I doing something terrible wrong, or effectively
require.cache
now is per-module?The text was updated successfully, but these errors were encountered: