Jest test: Cannot find module, in typescript component import Jest test: Cannot find module, in typescript component import typescript typescript

Jest test: Cannot find module, in typescript component import


You need to do little configuration for your jest test.Adding this snippet to your package.json should allow you to take your custom name and map it to your actual folder:

"moduleNameMapper": {  "^@fooBar/(.*)": "<rootDir>/src/barFoo/$1"},


Ok I just fixed this by created an index file inside of the /shared folder and then exporting out the models that way (Though it should have still worked without the index file):

import { moonHoldings } from '../../shared';

enter image description here

And the index.js:

export { moonHoldings, nomicsLink } from './copy';