FileStub.js used for lodash modules :-(
Created by: kentcdodds
Can you reproduce the problem with latest npm?
Yes
Description
Due to this config for Jest, lodash.<method-name>
modules are stubbed out as test-file-stub
. These are quite commonly used in common modules. For example, cheerio
(used by enzyme
) uses lodash.assignin
for _.extend
behavior and because the regex used in the Jest config matches lodash.
modules, it is mocked.
Expected behavior
Don't mock modules which resolve to modules ending in .js
Actual behavior
Mocks any modules referenced with a .
in their name (even if they resolve to .js
modules via normal CommonJS resolution semantics).
Environment
Mostly Irrelevant. I'm using v0.8.0 of react-scripts
Reproducible Demo
Happy to make a demo if that's needed, but I think the issue is pretty clear. The solution... I think that we need to go back from a blacklist (like we have now) to a whitelist (like we had before)... Effectively reverting #1077 which was meant to address #667 (closed), but unfortunately had this pretty serious side-effect :-(
I imagine that considering react-scripts
was released only about 10 hours ago, you'll start to see more and more people with this same issue. It would probably be good to get this fixed quickly to minimize impact.