jest-preset-angular icon indicating copy to clipboard operation
jest-preset-angular copied to clipboard

[Bug]: Component not resolved error when testing conditional templateUrl

Open rkrishnaanoutlook opened this issue 2 years ago • 0 comments

Version

12.2.2

Steps to reproduce

Example steps:

  1. Clone jest-preset-angular locally.
  2. Navigate to examples/example-app-v15/src/app/dashboard
  3. Copy dashboard.component.html in the same directory [dashboard.component.copy.html]
  4. Change templateUrl in dashboard.component.ts like this:
  templateUrl:
    true === true
        ? './dashboard.component.html'
        : './dashboard.component.copy.html',
  1. 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

rkrishnaanoutlook avatar Dec 02 '22 16:12 rkrishnaanoutlook