I've inherited a project that has folders like:
node_modules/
server/
├── node_modules/
├── src/
│ └── helpers/
│ ├── updateTransactions.ts
│ └── updateTransactions.test.ts
├── jest.config.ts
└── tsconfig.json
shared/
└── helpers/
└── datetime.ts
src/
└── index.tsx
jest.config.ts
tsconfig.json
If I cd
into server
and run yarn test
, I get Cannot find module '../../../shared/helpers/datetime.js' from 'src/helpers/updateTransactions.ts'
I think it's just because Jest does not yet have awareness of how to interpret import { getFormattedDatetimeUtcFromBlockTimestamp } from '../../../shared/helpers/datetime.js';
in updateTransactions.ts.
It's probably a simple configuration issue.
As you can see in various commented-out code here, I've tried all sorts of things: