Component is not resolved: templateUrl Angular Origin: On your device Last updated 15 Oct 2026

Angular tests: Component 'X' is not resolved: templateUrl: ./x.component.html — Did you run and wait for 'resolveComponentResources()'?

A test created a component whose external template was not compiled yet — compileComponents() was not called/awaited, or the test runner does not process templates.

Exact message you may see Component is not resolved: templateUrlDid you run and wait for 'resolveComponentResources()'?Component 'MyComponent' is not resolvedtemplateUrl: ./my.component.html
Seen on: Angular TypeScript

Meaning

With the CLI builder the template is compiled in advance. The error appears with Jest setups lacking the Angular preset, or when a test creates the component before await TestBed.compileComponents() finished. Standalone components in imports usually avoid it.

Common causes

  • Missing await TestBed.compileComponents() in beforeEach (non-CLI runner)
  • Jest not configured with jest-preset-angular (templateUrl not inlined)
  • Mixed Karma and Jest configuration
  • Test creates the component synchronously in beforeEach while async setup is pending

⚡ Quick fix

  1. Make beforeEach async and await TestBed.compileComponents()
  2. For Jest install and configure jest-preset-angular
  3. Use standalone components: imports: [MyComponent]

Detailed fix by platform

Angular

  1. beforeEach(async () => { await TestBed.configureTestingModule({ imports: [MyComponent] }).compileComponents(); });
  2. Jest: npm i -D jest jest-preset-angular and set preset: 'jest-preset-angular'

Code examples

Async setup

typescript
beforeEach(async () => {
  await TestBed.configureTestingModule({ imports: [MyComponent] }).compileComponents();
  fixture = TestBed.createComponent(MyComponent);   // only after compileComponents resolved
});

How to diagnose

  1. Runner — Karma or Jest?
  2. Setup — Awaited compileComponents?
  3. Preset — jest-preset-angular configured?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

Cannot find control with name — Angular: Error: Cannot find control with name: 'email' (reactive forms) (Angular)Cannot find control w…Could not find the builder's node package — Angular CLI: Could not find the '@angular-devkit/build-angular:browser' builder's node package / Cannot find module '@angular-devkit/build-angular/package.json' (Angular)Could not find the bu…exceeded maximum budget — Angular build: Error: bundle initial exceeded maximum budget. Budget 1.00 MB was not met by 120.00 kB with a total of 1.12 MB (Angular)exceeded maximum budg…Expected to be running in 'ProxyZone' — Angular tests: Error: Expected to be running in 'ProxyZone', but it was not found. (Angular)Expected to be runnin…Karma Disconnected / no captured browser — Angular tests: Disconnected, because no message in 30000 ms. / ERROR [launcher]: Cannot start ChromeHeadless (Angular)Karma Disconnected / …NG0301 — Angular: NG0301: Export of name 'x' not found! (template variable #x="exportAs") (Angular)NG0301Schema validation failed with the following errors — Angular CLI: Schema validation failed with the following errors: Data path "" must NOT have additional properties(xyz) (Angular)Schema validation fai…Component…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.