Angular 6 for Enterprise:Ready Web Applications
上QQ阅读APP看书,第一时间看更新

Declarations

The AppComponent should create the app test is failing. If you observe the error details, you'll see that AppComponent is failing to be created, because 'app-current-weather' is not a known element. Further, the error occurs if pointed out with a [ERROR ->] tag, and the last line spells things out for us, similar to the error originating from line 6 in AppComponent.html.

Include CurrentWeatherComponent in the declarations of app.component.spec.ts:

src/app/app.component.spec.ts
...
TestBed.configureTestingModule({
declarations: [AppComponent, CurrentWeatherComponent],
}).compileComponents()
...