I am trying to run my project's tests on my CI/CD machines. They are jest tests that have been running fine for some time on all my environments. I am going through package updates, and somewhere along the way, I began having issues. I see that every test is failing because if this error:
● Test suite failed to run
Cannot find module '/cicduser/myproject/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/interopRequireDefault' from 'src/setupTests.ts'
1 | /*
2 | * Filename: setupTests.ts
> 3 | * Classification: UNCLASSIFIED
| ^
at Resolver.resolveModule (node_modules/jest-runtime/node_modules/jest-resolve/build/index.js:306:11)
at Object.<anonymous> (src/setupTests.ts:3:30)
This is happening on a Debian Ubuntu-16 linux instance, with node 14.16.3 and npm 8.1.0.
This is not happening my local machine. My local machine runs these tests just fine. My local is a mac Catalina 10.15.7, and I've tried versions of node 14 and 16, as well as npm 7 and 8, and no issues. I did read Unable to resolve module @babel/runtime/helpers/interopRequireDefault, as well as a number of other related questions, but no solution is helping. I have tried
npm install @babel/runtimenpm install babel-preset-react-app"nohoist": ["**/babel-preset-react-app/@babel/runtime"] to package.jsonIts a little befuddling that the tests work fine on my laptop, with all variations of what I've tried above, and fail on my CI/CD instance, with all variations of what Ive tried above.
What can I do to debug this? Why would this issue persist, despite trying the best answers and suggestions as described above?
Try to clear jest cache
jest --clearCache
or
npm run test -- --clearCache
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With