title: UnitTest throws TypeError: componentFactory.create is not a function
body: <p>We are using Jest to Unit-Test our application. Since we upgraded from Angular-6 to Angular-8 a Unit-Test containing a dynamic component is failing with following Error-Message:</p>
  <pre><code>TypeError: componentFactory.create is not a function
  
        at ViewContainerRef_.Object.&lt;anonymous&gt;.ViewContainerRef_.createComponent (../../../packages/core/src/view/refs.ts:202:26)
        at src/app/something/something-detail/something-detail.component.ts:193:48
  </code></pre>
  <p>As far as I understand, the problem is located in the mock that we are using for this ViewChild:</p>
  <pre><code>@ViewChild('somethingView', { read: ViewContainerRef })
    viewContainerRef: ViewContainerRef;
  </code></pre>
  <p>In the file for the unit-tests we set up this dynamic component as following:</p>
  <pre><code>// mock of the dynamic component
  describe('SomethingComponent', () =&gt; {
     const makeMockComponent = () =&gt; ({
         instance: { selectLink: new Subject(), paragraphId: '' },
         destroy: jest.fn(),
     });
     class Page {
        dynamicComponent: {
           instance: { selectLink: Subject&lt;any&gt;; paragraphId: string };
           destroy: jest.Mock;
        };
  
        constructor() {
           this.dynamicComponent = makeMockComponent();
  
           component.viewContainerRef = {
             createComponent: jest.fn(() =&gt; this.dynamicComponent),
           } as any;
        }
     }
     
     beforeEach(async(() =&gt; {
        createComponent();
     }));
  
     // The failing unit-test
     it('should create', () =&gt; {
        expect(component).toBeTruthy();
     });
  }
  </code></pre>
  <p>I am not able to debug this any further. I left out a lot of code, that I think is not connected to the problem. If further information is needed, please respond. Hopefully someone can help me with this.</p>