I'm trying to use jest in an Angular 13 project for testing. I use jest-preset-angular with @angular-builders/jest.
I use ngx-pipes, which is a library that is not compiled for Angular 13. It works fine during normal Angular build. But in the jest test run it causes the error:
Error: Unexpected value 'NgStringPipesModule2' imported by the module 'DynamicTestModule'. Please add an @NgModule annotation.
Minimal reproduction: https://github.com/dhcode/jest-preset-angular-13-issue
In my actual project I have the same error also with other Angular libraries.
I ran ng serve
before, so the ngcc compilation was done before running the tests.
How can I make my tests run and recognize the external libraries, that have been built with an older Angular version?