I have two modules:
- Module A
- Component Home
- Component Presentation
- Module B
- Component CustomInput
app.module.ts (Module A)
@NgModule({ declarations: [ HomeComponent, PresentationComponent ], imports: [ ModuleB ] }) export class AppModule { } presentation.component.html
<custom-input><custom-input> presentation.component.spec.ts
describe('PresentationComponent', () => { let component: PresentationComponent; let fixture: ComponentFixture<PresentationComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [PresentationComponent], imports: [ModuleB] }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(PresentationComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); }); b.module.ts (Module B)
@NgModule({ declarations: [ CustomInputComponent ], exports: [ CustomInputComponent ] }) export class ModubleB { } The component Presentation uses the CustomInput tag in its html, so in module B, I exported CustomInputComponent then import the module B into module A.
The problem is, in the spec file of Presentation Component, I also have to import Module B into the Test Module. But I have this error:
Component HomeComponent is not part of any NgModule or the module has not been imported into your module I really don't understand why ? Any ideas ? Thanks !

app.module.ts