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

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

Closed
wardbell opened this issue Sep 3, 2016 · 2 comments · Fixed by #13543
Closed

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

wardbell opened this issue Sep 3, 2016 · 2 comments · Fixed by #13543
Assignees
Labels
area: testing Issues related to Angular testing features, such as TestBed hotlist: error messages

Comments

@wardbell
Copy link
Contributor

wardbell commented Sep 3, 2016

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]
@wardbell wardbell changed the title Testing: misleading error message about need to compileComponents Testing: misleading error message when don't call compileComponents Sep 3, 2016
@vicb vicb added area: testing Issues related to Angular testing features, such as TestBed hotlist: error messages labels Sep 5, 2016
@asadsahi
Copy link

asadsahi commented Sep 15, 2016

@wardbell @tbosch I am having same misleading error with template urls and stylesUrl set with webpack. Even tutorials say, I don't have to call compile components because webpack compiles it. But it doesn't make any difference. If I change to inline templates and styles, it works ok though.
What do I need to do special with webpack?

@tbosch tbosch removed their assignment Nov 12, 2016
@juliemr juliemr self-assigned this Nov 22, 2016
DzmitryShylovich pushed a commit to DzmitryShylovich/angular that referenced this issue Dec 17, 2016
hansl pushed a commit that referenced this issue Dec 22, 2016
IgorMinar pushed a commit to IgorMinar/angular that referenced this issue Jan 6, 2017
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: testing Issues related to Angular testing features, such as TestBed hotlist: error messages
Projects
None yet
5 participants