title: Unexpected directive 'InformationComponent' imported by the module 'DynamicTestModule'. Please add a @NgModule annotation
body: <p>I know there is a similar link to an answer on Stackoverflow but that did not solve my problem, so i explain my case, i did ng test, but failing with the below error :</p>
  
  <blockquote>
  <pre><code>Failed: Unexpected directive 'InformationComponent' imported by the module 'DynamicTestModule'. Please add a @NgModule annotation.
  error properties: Object({ ngSyntaxError: true })
  Error: Unexpected directive 'InformationComponent' imported by the module 'DynamicTestModule'. Please add a @NgModule annotation.
      at syntaxError (http://localhost:9877/_karma_webpack_/node_modules/@angular/compiler/fesm2015/compiler.js:2175:1)
      at http://localhost:9877/_karma_webpack_/node_modules/@angular/compiler/fesm2015/compiler.js:20068:1
      at &lt;Jasmine&gt;
      at CompileMetadataResolver.getNgModuleMetadata (http://localhost:9877/_karma_webpack_/node_modules/@angular/compiler/fesm2015/compiler.js:20043:1)
      at JitCompiler._loadModules (http://localhost:9877/_karma_webpack_/node_modules/@angular/compiler/fesm2015/compiler.js:25824:1)
      at JitCompiler._compileModuleAndAllComponents (http://localhost:9877/_karma_webpack_/node_modules/@angular/compiler/fesm2015/compiler.js:25813:1)
      at JitCompiler.compileModuleAndAllComponentsAsync (http://localhost:9877/_karma_webpack_/node_modules/@angular/compiler/fesm2015/compiler.js:25775:1)
      at CompilerImpl.compileModuleAndAllComponentsAsync (http://localhost:9877/_karma_webpack_/node_modules/@angular/platform-browser-dynamic/fesm2015/platform-browser-dynamic.js:244:1)
      at TestingCompilerImpl.compileModuleAndAllComponentsAsync (http://localhost:9877/_karma_webpack_/node_modules/@angular/platform-browser-dynamic/fesm2015/testing.js:159:1)
      at TestBedViewEngine.compileComponents (http://localhost:9877/_karma_webpack_/node_modules/@angular/core/fesm2015/testing.js:3623:1)
  Error: Unexpected directive 'InformationComponent' imported by the module 'DynamicTestModule'. Please add a @NgModule annotation.
  error properties: Object({ ngSyntaxError: true })
      at syntaxError (http://localhost:9877/_karma_webpack_/node_modules/@angular/compiler/fesm2015/compiler.js:2175:1)
      at http://localhost:9877/_karma_webpack_/node_modules/@angular/compiler/fesm2015/compiler.js:20068:1
      at &lt;Jasmine&gt;
      at CompileMetadataResolver.getNgModuleMetadata (http://localhost:9877/_karma_webpack_/node_modules/@angular/compiler/fesm2015/compiler.js:20043:1)
      at JitCompiler._loadModules (http://localhost:9877/_karma_webpack_/node_modules/@angular/compiler/fesm2015/compiler.js:25824:1)
      at JitCompiler._compileModuleAndAllComponents (http://localhost:9877/_karma_webpack_/node_modules/@angular/compiler/fesm2015/compiler.js:25813:1)
      at JitCompiler.compileModuleAndAllComponentsSync (http://localhost:9877/_karma_webpack_/node_modules/@angular/compiler/fesm2015/compiler.js:25772:1)
      at CompilerImpl.compileModuleAndAllComponentsSync (http://localhost:9877/_karma_webpack_/node_modules/@angular/platform-browser-dynamic/fesm2015/platform-browser-dynamic.js:232:1)
      at TestingCompilerImpl.compileModuleAndAllComponentsSync (http://localhost:9877/_karma_webpack_/node_modules/@angular/platform-browser-dynamic/fesm2015/testing.js:151:1)
      at TestBedViewEngine._initIfNeeded (http://localhost:9877/_karma_webpack_/node_modules/@angular/core/fesm2015/testing.js:3645:1)
  Error: Expected undefined to be truthy.
      at &lt;Jasmine&gt;
      at UserContext.&lt;anonymous&gt; (http://localhost:9877/_karma_webpack_/src/app/modules/verification/components/results/result/result.component.spec.ts:27:23)
      at ZoneDelegate.invoke (http://localhost:9877/_karma_webpack_/node_modules/zone.js/dist/zone-evergreen.js:359:1)
      at ProxyZoneSpec.onInvoke (http://localhost:9877/_karma_webpack_/node_modules/zone.js/dist/zone-testing.js:308:1)
  </code></pre>
  </blockquote>
  
  <p>I tried a lot of things but nothing works I still have this error.</p>
  
  <h2>uploadcomponent.spec.ts</h2>
  
  <pre><code>import { async, ComponentFixture, TestBed } from '@angular/core/testing';
  
      import { UploadComponent } from './upload.component';
      import { UploaderComponent } from '../uploader/uploader.component';
      import { AnalyseComponent } from '../analyse/analyse.component';
  
      describe('UploadComponent', () =&gt; {
        let component: UploadComponent;
        let fixture: ComponentFixture&lt;UploadComponent&gt;;
  
        beforeEach(async(() =&gt; {
          TestBed.configureTestingModule({
            declarations: [ UploadComponent, UploaderComponent, AnalyseComponent ]
          })
          .compileComponents();
        }));
  
        beforeEach(() =&gt; {
          fixture = TestBed.createComponent(UploadComponent);
          component = fixture.componentInstance;
          fixture.detectChanges();
        });
  
        it('should create', () =&gt; {
          expect(component).toBeTruthy();
        });
      });
  </code></pre>
  
  <h2>information-component.ts</h2>
  
  <pre><code>import { Component, OnInit, Input, OnChanges } from '@angular/core';
  import * as InformationMessages from '../../../json/InformationMessages.json';
  
  @Component({
    selector: 'app-information',
    templateUrl: './information.component.html',
    styleUrls: ['./information.component.css']
  })
  export class InformationComponent implements OnInit {
  
    constant: any = (InformationMessages as any).default;
  
    constructor() { }
  
    @Input() fileName: string;
    @Input() result: string;
  
    ngOnInit() {
    }
  
  }
  </code></pre>
  
  <p>I hope you can help me</p>
  
  <h2>app.module.ts</h2>
  
  <pre><code>import {BrowserModule} from '@angular/platform-browser';
  import {ErrorHandler, NgModule} from '@angular/core';
  
  import {AppComponent} from './app.component';
  import {AppRoutingModule} from './app-routing.module';
  import {BreadcrumbModule} from 'primeng/breadcrumb';
  import {HttpClientModule} from '@angular/common/http';
  import {ErrorComponent} from './components/error/error.component';
  import {HomeComponent} from './components/home/home.component';
  import {MenuComponent} from './components/menu/menu.component';
  import {HeadComponent} from './components/head/head.component';
  import {ArianeComponent} from './components/ariane/ariane.component';
  import {PlanComponent} from './components/plan/plan.component';
  import {SeparatorComponent} from './components/separator/separator.component';
  import {FooterComponent} from './components/footer/footer.component';
  import {EsignatureErrorHandler} from './handlers/esignature-error-handler';
  import {ToastrModule} from 'ngx-toastr';
  import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
  import {FaIconLibrary, FontAwesomeModule} from '@fortawesome/angular-fontawesome';
  import {faArrowRight} from '@fortawesome/free-solid-svg-icons';
  
  
  @NgModule({
    declarations: [
      AppComponent, HomeComponent, MenuComponent, HeadComponent, ArianeComponent,
      PlanComponent, SeparatorComponent, FooterComponent, ErrorComponent
    ],
    imports: [
      BrowserModule,
      AppRoutingModule,
      BreadcrumbModule,
      HttpClientModule,
      BrowserModule,
      BrowserAnimationsModule,
      FontAwesomeModule,
      ToastrModule.forRoot(),
    ],
    providers: [
      {
        provide: ErrorHandler,
        useClass: EsignatureErrorHandler,
      },
    ],
    exports: [
    ],
  
    bootstrap: [AppComponent]
  })
  export class AppModule {
    constructor(library: FaIconLibrary) {
      library.addIcons(faArrowRight);
    }
  }
  </code></pre>