From c792c9f8b80f61824bb894b79aab924c622e5b44 Mon Sep 17 00:00:00 2001 From: William KOZA Date: Tue, 21 Feb 2017 23:29:11 +0100 Subject: [PATCH] feat(@angular/cli): add async method in Jasmine Tests blueprints (#4775) --- .../ng2/files/__path__/app/app.component.spec.ts | 7 +++---- tests/e2e/tests/build/assets.ts | 9 ++++----- tests/e2e/tests/test/test-scripts.ts | 9 +++++---- 3 files changed, 12 insertions(+), 13 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); 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;