Skip to content

Testing: misleading error message when don't call compileComponents #11301

@wardbell

Description

@wardbell

I'm submitting a ... (check one with "x")

[x] bug report
[ ] feature request
[ ] support request 

Current behavior

Component doesn't have a templateUrl but DOES have styleUrls.

@Component({
  selector: 'dashboard-hero',
  template: '<div class="hero" (click)="click()">{{hero.name | uppercase}}</div>',
  styleUrls: ['app/dashboard/dashboard-hero.component.css']
})

When don't call TestBed.compileComponents the error message is

Error: This test module uses the component DashboardHeroComponent which is using a "templateUrl", but they were never compiled. Please call "TestBed.compileComponents" before your test.

This is ALMOST correct. The problem is that it is the styleUrls that cause the problem, not the (non-existent) templateUrl

Expected/desired behavior

Could say

which is using a "templateUrl" or "stylerUrls"

Please tell us about your environment:

  • Angular version: 2.0.0-rc.6
  • Browser: [all ]
  • Language: [all]

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions