From 202e324d45c9135d50c15b81205e3f11af02894d Mon Sep 17 00:00:00 2001 From: WilliamKoza Date: Fri, 17 Feb 2017 11:54:12 +0100 Subject: [PATCH 1/2] add async method if use compileComponents() because compileComponents is asynchronous --- .../ng2/files/__path__/app/app.component.spec.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/@angular/cli/blueprints/ng2/files/__path__/app/app.component.spec.ts b/packages/@angular/cli/blueprints/ng2/files/__path__/app/app.component.spec.ts index 9856adfbb87e..e678a762c761 100644 --- a/packages/@angular/cli/blueprints/ng2/files/__path__/app/app.component.spec.ts +++ b/packages/@angular/cli/blueprints/ng2/files/__path__/app/app.component.spec.ts @@ -3,7 +3,7 @@ import { RouterTestingModule } from '@angular/router/testing';<% } %> import { AppComponent } from './app.component'; describe('AppComponent', () => { - beforeEach(() => { + beforeEach(async(() => { TestBed.configureTestingModule({<% if (routing) { %> imports: [ RouterTestingModule @@ -11,9 +11,8 @@ describe('AppComponent', () => { declarations: [ AppComponent ], - }); - TestBed.compileComponents(); - }); + }).compileComponents(); + })); it('should create the app', async(() => { const fixture = TestBed.createComponent(AppComponent); From 956eee147d32722dfbcff89f126da932f82199da Mon Sep 17 00:00:00 2001 From: WilliamKoza Date: Fri, 17 Feb 2017 21:03:07 +0100 Subject: [PATCH 2/2] add async method if we use compileComponents() because compileComponents is asynchronous --- tests/e2e/tests/build/assets.ts | 9 ++++----- tests/e2e/tests/test/test-scripts.ts | 9 +++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/e2e/tests/build/assets.ts b/tests/e2e/tests/build/assets.ts index 410b923ee16a..e353d77351d9 100644 --- a/tests/e2e/tests/build/assets.ts +++ b/tests/e2e/tests/build/assets.ts @@ -77,17 +77,16 @@ export default function () { import { AppComponent } from './app.component'; describe('AppComponent', () => { - beforeEach(() => { + beforeEach(async(() => { TestBed.configureTestingModule({ imports: [ HttpModule ], declarations: [ AppComponent - ], - }); - TestBed.compileComponents(); - }); + ] + }).compileComponents(); + })); it('should create the app', async(() => { const fixture = TestBed.createComponent(AppComponent); diff --git a/tests/e2e/tests/test/test-scripts.ts b/tests/e2e/tests/test/test-scripts.ts index ddc9fd90b318..f3ee3993f0f2 100644 --- a/tests/e2e/tests/test/test-scripts.ts +++ b/tests/e2e/tests/test/test-scripts.ts @@ -29,10 +29,11 @@ export default function () { import { AppComponent } from './app.component'; describe('AppComponent', () => { - beforeEach(() => { - TestBed.configureTestingModule({ declarations: [ AppComponent ] }); - TestBed.compileComponents(); - }); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AppComponent ] + }).compileComponents(); + })); it('should have access to string-script.js', async(() => { let app = TestBed.createComponent(AppComponent).debugElement.componentInstance;