-
-
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
Split internal module registry from main module registry #1572
Conversation
430040f
to
998a02a
Compare
wow, I was just messing with you but if that is what it takes to get you to contribute, that's awesome. I also cannot believe that you actually went into jest-runtime and just made an awesome fix like this. I literally had this internal registry before but it was way more complex and I thought we didn't need it. Then I added "* Make internal registry that's persistent (?)" to my wishlist. You deserve a medal. Would you mind also adding a test for this? It can be either an integration test in integration_tests (every folder should contain a test project and then the top level tests folder is used to call |
Current coverage is 90.31% (diff: 100%)@@ master #1572 diff @@
==========================================
Files 28 28
Lines 1123 1125 +2
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 1014 1016 +2
Misses 109 109
Partials 0 0
|
Added integration test (with a longer than 1 line comment, sorrysss) |
thanks, this is great. 🎉 |
Split internal module registry from main module registry
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. |
Here's a possible fix for #1571.
When the
mkdirp
module is first required, it's required fromjest-utils
, which is required from jasmine-check.js, which is required usingrequireInternalModule
from jest-jasmine2/index.js. Because requiring internal modules and requiring "normal" modules (e.g. in a test or within your own code) use the same module registry, whenmkdirp
is required by the app code, Jest already has required it (as an internal module), and thus it doesn't try to require it again and just returns it from the module registry, meaning it doesn't pick up thefs
mock from our test file.This PR splits the module registries so that conflict doesn't happen, and we can reliably use internal modules within Jest without conflicting with the test environment.
P.S. Sorry for being annoying earlier @cpojer...this is my attempt at redemption.