"ng test" returns errors even after adding "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas'
Development Environment: @angular/cli: 1.0.0-beta.30 node: 7.4.0 Chrome 56.0.2924 (Mac OS X 10.11.6)
After creating a few tests, when I run "ng test" I get errors like this one:
- If 'app-search-field' is an Angular component, then verify that it is part of this module.
- If 'app-search-field' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("
[ERROR ->]"): AppComponent@6:8
My understanding is that this has to do with the naming of selector tags.
So, following the instructions in the error above, as well as what I found online, I added "CUSTOM_ELEMENTS_SCHEMA" to both my root module, and all other modules. But I am still getting the same errors.
What was the problem here? I am stuck on this.
For any who find this trying to solve this problem like I did: you have to import and add the component you generated to the app.component.spec.ts (or I guess whatever the appropriate spec.ts file is for your situation).
@JKGisMe can you elaborate on that please?
@ERPedersen For me worked adding generated component to declartaions array like this:
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LinkingToolComponent, GeneratedComponent ],
imports: [MaterialModule, NoopAnimationsModule]
})
.compileComponents();
}));
@ERPedersen, thanks bro !!!!!!!!
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.