-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Labels
Description
When trying to configure node's util and event model's to NOT be mocked by default using unmockedModulePathPatterns, Jest does not honor the configuration and still mocks the modules. This leads to adding extra dontMock calls in all tests. See http://stackoverflow.com/questions/25017484/how-do-i-run-some-config-before-every-jest-test-run
"unmockedModulePathPatterns": [
"util",
"event"
]
From looking at the Jest HasteModuleLoader, all node modules listed in NODE_CORE_MODULES get mocked by default and it doesn't look in the unmockedModulePathPatterns. Temporarily, I tried updating the _shouldMock method to return false for "util", but then I got a "no such file or directory 'util'" error. So it looks like there is a bigger code change than just telling jest it should not be mocked.