jest-preset-angular
jest-preset-angular copied to clipboard
[Bug]: Component not resolved error when testing conditional templateUrl
Version
12.2.2
Steps to reproduce
Example steps:
- Clone jest-preset-angular locally.
- Navigate to examples/example-app-v15/src/app/dashboard
- Copy dashboard.component.html in the same directory [dashboard.component.copy.html]
- Change
templateUrl
in dashboard.component.ts like this:
templateUrl:
true === true
? './dashboard.component.html'
: './dashboard.component.copy.html',
- Run
npm run test
Expected behavior
Expect dashboard.component.spec.ts to pass
Actual behavior
Throws this error:
Component 'DashboardComponent' is not resolved:
- templateUrl: ./dashboard.component.html
Did you run and wait for 'resolveComponentResources()'?
Additional context
No response
Environment
System:
OS: Windows 10 10.0.19045
CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
Binaries:
Node: 16.17.1 - C:\Program Files\nodejs\node.EXE
Yarn: 3.2.3 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.15.0 - C:\Program Files\nodejs\npm.CMD