2017-09-01 121 views
-1

Angular 4.3.0 & cli 1.2.0:在運行命令之後:「ng test」我已經得到了這些故障Angular 4.3.0&cli 1.2.0:運行命令之後:「ng test」我得到了這些故障

AppComponent should create the app should have as title 'app' should render title in a h1 tag DashboardComponent should be created 
+0

我想,這是不是你的測試環境中失敗,但它是測試用例的失敗。你應該寫一個正確的測試用例。 –

+0

@ARUN:你能解釋一下嗎? –

+0

@Samil在運行'ng test'時能不能分享你終端的截圖? –

回答

1

ng test校驗碼取決於你的* .spec.ts,所以檢查app.component.spec.ts,查找錯誤消息,像

it(`should have as title 'app'`, async(() => { 
    const fixture = TestBed.createComponent(AppComponent); 
    const app = fixture.debugElement.componentInstance; 
    expect(app.title).toEqual('app'); // <--- this line cause the error, it means in your app.component.ts there should has a variable **title** and equal *app* 
}));