title: Angular Karma Jasmine Error: Illegal state: Could not load the summary for directive
body: <p>I'm developing a <a href="https://github.com/Ismaestro/angular4-example-app" rel="noreferrer">github repository</a> (with angular 7 and angular-cli), and I have some tests with Karma and Jasmine working in the master branch.</p>
  <p>Now I'm trying to add lazy loading feature, the thing is, that the tests that before passed, now they do not. It's funny because only the tests from the lazy loading module are failing...</p>
  <p>Here is the code and the error:</p>
  <pre><code>import {async, TestBed} from '@angular/core/testing';
  import {APP_BASE_HREF} from '@angular/common';
  import {AppModule} from '../../app.module';
  import {HeroDetailComponent} from './hero-detail.component';
  
  describe('HeroDetailComponent', () =&gt; {
    beforeEach(async(() =&gt; {
      TestBed.configureTestingModule({
        imports: [AppModule
        ],
        providers: [
          {provide: APP_BASE_HREF, useValue: '/'}
        ],
      }).compileComponents();
    }));
  
    it('should create hero detail component', (() =&gt; {
      const fixture = TestBed.createComponent(HeroDetailComponent);
      const component = fixture.debugElement.componentInstance;
      expect(component).toBeTruthy();
    }));
  });
  </code></pre>
  <p>The error is this:</p>
  <pre><code>Chrome 58.0.3029 (Mac OS X 10.12.6) HeroDetailComponent should create hero detail component FAILED
      Error: Illegal state: Could not load the summary for directive HeroDetailComponent.
          at syntaxError Users/ismael.ramos.silvan/WebstormProjects/angular4-example-app/~/@angular/compiler/@angular/compiler.es5.js:1690:22)
          at CompileMetadataResolver.getDirectiveSummary Users/ismael.ramos.silvan/WebstormProjects/angular4-example-app/~/@angular/compiler/@angular/compiler.es5.js:15272:1)
          at JitCompiler.getComponentFactory Users/ismael.ramos.silvan/WebstormProjects/angular4-example-app/~/@angular/compiler/@angular/compiler.es5.js:26733:26)
          at TestingCompilerImpl.getComponentFactory Users/ismael.ramos.silvan/WebstormProjects/angular4-example-app/~/@angular/compiler/@angular/compiler/testing.es5.js:484:1)
          at TestBed.createComponent Users/ismael.ramos.silvan/WebstormProjects/angular4-example-app/~/@angular/core/@angular/core/testing.es5.js:874:1)
          at Function.TestBed.createComponent Users/ismael.ramos.silvan/WebstormProjects/angular4-example-app/~/@angular/core/@angular/core/testing.es5.js:652:1)
          at UserContext.it Users/ismael.ramos.silvan/WebstormProjects/angular4-example-app/src/app/heroes/hero-detail/hero-detail.component.spec.ts:18:29)
          at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke Users/ismael.ramos.silvan/WebstormProjects/angular4-example-app/~/zone.js/dist/zone.js:391:1)
          at ProxyZoneSpec.onInvoke Users/ismael.ramos.silvan/WebstormProjects/angular4-example-app/~/zone.js/dist/proxy.js:79:1)
          at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke Users/ismael.ramos.silvan/WebstormProjects/angular4-example-app/~/zone.js/dist/zone.js:390:1)
  </code></pre>
  <p>You can see the entire project, for more details if you need it.</p>
  <p><strong>UPDATE: added declaration like this:</strong></p>
  <pre><code>beforeEach(async(() =&gt; {
      TestBed.configureTestingModule({
        imports: [
          AppModule
        ],
        declarations: [HeroDetailComponent],
        providers: [
          {provide: APP_BASE_HREF, useValue: '/'}
        ],
      }).compileComponents();
    }));
  </code></pre>
  <p>Now, new errors appears:</p>
  <pre><code>The pipe 'translate' could not be found (&quot;&lt;h1 class=&quot;section-title&quot;&gt;{{[ERROR -&gt;]'heroDetail' | translate}}&lt;/h1&gt;
      &lt;md-progress-spinner *ngIf=&quot;!hero&quot;
                           class=&quot;progre&quot;): ng:///DynamicTestModule/HeroDetailComponent.html@0:28
      Can't bind to 'color' since it isn't a known property of 'md-progress-spinner'.
  </code></pre>
  <p>And more... it's like all directives and components from angular material, and the pipe translate from ngx-translate/core do not appear to be included...</p>