Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rkrishnaanoutlook opened this issue Dec 2, 2022 · 0 comments

Comments

@rkrishnaanoutlook
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants