Skip to content

modulePathIgnorePatterns does not work for node modules. #106

@iamrandys

Description

@iamrandys

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions