mkg0 / jest-webpack-resolver

path resolver for jest through the webpack.config. Auto detect webpack's resolve properties like aliases, plugins and more
44 stars 6 forks source link

Jest module mocks do not work with this resolver #11

Open mlippens opened 6 years ago

mlippens commented 6 years ago

I've got an example project here to provide some context. It provides one test that fails with the webpack resolver and succeeds when turning the resolver off. The repository can be found here: https://github.com/mlippens/jest-webpack-resolver-mock-issue.

The issue seems to be the combination of the webpack resolver with jest.mock('../../someModule'), when using the variant of mock using a factory then all is well jest.mock('../../someModule', () => ({ getLogLevel() {} })).

foleyatwork commented 5 years ago

I'm running into this as well, no leads just yet but I'd love to help come up with a fix.

vzaidman commented 4 years ago

has to do with https://github.com/jamietre/jest-custom-resolver-problem