-
-
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
Fix requireActual fail with moduleNameMapper #8210
Fix requireActual fail with moduleNameMapper #8210
Conversation
4558bff
to
0918cc1
Compare
Codecov Report
@@ Coverage Diff @@
## master #8210 +/- ##
==========================================
+ Coverage 62.29% 62.34% +0.04%
==========================================
Files 265 265
Lines 10551 10551
Branches 2563 2564 +1
==========================================
+ Hits 6573 6578 +5
+ Misses 3388 3385 -3
+ Partials 590 588 -2
Continue to review full report at Codecov.
|
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 for the PR! I think this makes sense :)
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.
Looks good! It also doesn't seem to cause measurable performance impact (cold & warm cache) for a non-mapped test suite as we have in src/packages/*
.
Would like @scotthovestadt to also have a look
@levinqdl mind resolving the conflicts?
1c63982
to
883773e
Compare
Hi @thymikee, conflicts have been resolved. |
Ok, merging. Thanks you so much @levinqdl! Looking forward to future contributions :) |
This just broke quite a lot of our tests, so I came here to complain but then realized that we relied on a buggy implementation and that I misread the docs. Fixed our setup and needed to leave this comment. |
* Remove the need to import built versions of packages in integration tests using jest's moduleNameMapper option * Upgrade jest with bugfix: jestjs/jest#8210 * prettify
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 PR fixes #7981 , requireActual not work with moduleNameMapper, witch currently throws an error.
This PR make
jest-resolve
resolveModule
invokeresolveStubModuleName
, which resolves module with moduleNameMapper.resolveStubModuleName
is invoked beforeresolveModuleFromDirIfExists
, so that moduleNameMapper config can override default behavior.Test plan
Test requireActual with a moduleNameMapper configuration, and it should resolve the module successfully.