Absolute paths (baseUrl) gives error: Cannot find module

I was struggling with the same problem and actually it turns out that a simple change seems to do the trick.

I just updated the moduleDirectories field in jest.config.js.

Before

moduleDirectories: ['node_modules']

After

moduleDirectories: ['node_modules', 'src']

Leave a Comment