Jest Tests Failing - "Cannot find module 'apollo-angular'" #1854
-
Hello! I'm in the processing of upgrading from Angular 12 to Angular 14 (yes I know 15 was released recently haha...). I'm having the hardest time getting my tests to function. I ran all of the migrations via Nx and they were successful. However I'm still receiving the same error. I've been at this issue for over a week now and could really use some insight. My application builds and runs fine. But tests are not seeing a specific apollo-angular module in my node_modules folder:
I'm not finding much on SO regarding this issue.. But any test that uses the apollo-angular as a dependency are failing now.
I'm trying this on both node 14 and 16. I read something about apollo-angular using mjs and tried a few things to allow for that. But to be frank, I don't know much about mjs/ES modules and how it impacts jest. I've and tried a few things but nothing seems to have worked: I've also tried changing the
This was recommended by a few SO/forum posts. However I have had no luck with this solution. Not sure if anyone has run into this before.. but hoping for some insight/ideas? Any help would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
A solution has appeared! After a ton of research, I found that adding the following resolver to my jest.config.ts allowed the tests to execute successfully.
The key factors of this fix were the transformIgnorePatterns of Hope this helps someone else! |
Beta Was this translation helpful? Give feedback.
A solution has appeared! After a ton of research, I found that adding the following resolver to my jest.config.ts allowed the tests to execute successfully.