I have an Angular 14 application using Jest for unit testing. For some reason not worth mentioning here we need to compute the templateUrl during build time like this:
const suff = "v1";
@Component({
...
templateUrl: `./my-comp${suff}.component.html`
The problem is that when trying to run the tests jest complains saying:
Component 'MyComponent' is not resolved:
- templateUrl: ./my-compv1.component.html
Did you run and wait for 'resolveComponentResources()'?
The weird thing is that in the error the templateUrl is resolved fine.
Reading other questions I tried to set skipNgcc: false
on the jest preset and also "emitDecoratorMetadata": true
in the tsconfig.spec.json but nothing solved the issue