From 16454229c00bc07261ee19681571002f1edc70df Mon Sep 17 00:00:00 2001 From: Dzmitry Shylovich Date: Sat, 17 Dec 2016 16:29:01 +0300 Subject: [PATCH] fix(testing): improve misleading error message when don't call compileComponents Closes #11301 --- modules/@angular/core/testing/test_bed.ts | 2 +- modules/@angular/platform-browser/test/testing_public_spec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/@angular/core/testing/test_bed.ts b/modules/@angular/core/testing/test_bed.ts index 8139f5ecc4d4d..6436162194174 100644 --- a/modules/@angular/core/testing/test_bed.ts +++ b/modules/@angular/core/testing/test_bed.ts @@ -267,7 +267,7 @@ export class TestBed implements Injector { } catch (e) { if (e.compType) { throw new Error( - `This test module uses the component ${stringify(e.compType)} which is using a "templateUrl", but they were never compiled. ` + + `This test module uses the component ${stringify(e.compType)} which is using a "templateUrl" or "styleUrls", but they were never compiled. ` + `Please call "TestBed.compileComponents" before your test.`); } else { throw e; diff --git a/modules/@angular/platform-browser/test/testing_public_spec.ts b/modules/@angular/platform-browser/test/testing_public_spec.ts index 782dab72621a4..b7b4d98bcf222 100644 --- a/modules/@angular/platform-browser/test/testing_public_spec.ts +++ b/modules/@angular/platform-browser/test/testing_public_spec.ts @@ -503,7 +503,7 @@ export function main() { {declarations: [CompWithUrlTemplate]}, () => TestBed.createComponent(CompWithUrlTemplate)))) .toThrowError( - `This test module uses the component ${stringify(CompWithUrlTemplate)} which is using a "templateUrl", but they were never compiled. ` + + `This test module uses the component ${stringify(CompWithUrlTemplate)} which is using a "templateUrl" or "styleUrls", but they were never compiled. ` + `Please call "TestBed.compileComponents" before your test.`); restoreJasmineIt();