title: Angular Circular Dependency issue in Jest unit tests
body: <p>I have the following Angular Components. They compile and run fine in my application. However, when I include the module in my Jest test, I get errors. I don't know if this is an issue with typescript config, Angular, Jest or the combination.</p>
  
  <p>Components:</p>
  
  <pre><code>@Component({
    selector: 'child-component',
    template: '&lt;div&gt;Child here.&lt;/div&gt;'
  })
  export class ChildComponent {
    constructor( @Inject(forwardRef(() =&gt; ParentComponent)) private 
  parentComponent: ParentComponent ) { }
  }
  
  @Component({
    selector: 'parent-component',
    template: '&lt;div&gt;
      &lt;child-component&gt;&lt;/child-component&gt;
      &lt;child-component&gt;&lt;/child-component&gt;
    &lt;/div&gt;'
  })
  export class ParentComponent{
    @ViewChildren(ChildComponent) _children: QueryList&lt;ChildComponent&gt;;
  }
  
  const EXPORTED_DECLARATIONS = [
    ChildComponent,
    ParentComponent
  ];
  
  @NgModule({
    exports: [EXPORTED_DECLARATIONS],
    declarations: [EXPORTED_DECLARATIONS]
  })
  export class TestingModule { }
  </code></pre>
  
  <p>As you can see there is a circular dependency. However, it should be fixed with <code>@Inject(forwardRef(() =&gt; ParentComponent))</code> but this doesn't work.</p>
  
  <p>spec:</p>
  
  <pre><code>import { ComponentFixture, TestBed } from '@angular/core/testing';
  import { TestingModule } from './test';
  import { Component, forwardRef } from '@angular/core';
  
  describe( 'TestComponent', () =&gt; {
  
    let component: TestTestComponent;
    let fixture: ComponentFixture&lt;TestComponent&gt;;
  
    beforeEach(() =&gt; {
      TestBed.configureTestingModule({
        declarations: [ TestComponent ],
        imports: [
          TestingModule
        ]
      });
  
      fixture = TestBed.createComponent(TestComponent);
      component = fixture.componentInstance;
    } );
  
    it( 'default', () =&gt; {
      expect( fixture ).toMatchSnapshot();
    });
  
  });
  
  @Component({
    selector: 'test-test-1234',
    template: `&lt;parent-component&gt;&lt;/parent-component&gt;`
  })
  class TestComponent { }
  </code></pre>
  
  <p>And I get the following error when I run my unit test.</p>
  
  <p><code>ReferenceError: ParentComponent is not defined</code></p>
  
  <p>I would like to add that if I do the same with Jasmine / Karma I do not get this error.</p>