diff --git a/packages/angular-cli/blueprints/component/files/__path__/__name__.component.spec.ts b/packages/angular-cli/blueprints/component/files/__path__/__name__.component.spec.ts index e7ed84fac3d2..bd054ef7d49a 100644 --- a/packages/angular-cli/blueprints/component/files/__path__/__name__.component.spec.ts +++ b/packages/angular-cli/blueprints/component/files/__path__/__name__.component.spec.ts @@ -4,8 +4,18 @@ import { TestBed, async } from '@angular/core/testing'; import { <%= classifiedModuleName %>Component } from './<%= dasherizedModuleName %>.component'; describe('Component: <%= classifiedModuleName %>', () => { - it('should create an instance', () => { - let component = new <%= classifiedModuleName %>Component(); - expect(component).toBeTruthy(); + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [ + <%= classifiedModuleName %>Component + ], + }); }); + + it('should create an instance', async(() => { + let fixture = TestBed.createComponent(<%= classifiedModuleName %>Component); + let cmp = fixture.debugElement.componentInstance; + expect(cmp).toBeTruthy(); + })); });