title: No provider for TestingCompilerFactory! in Angular 2 Jasmine tests
body: <p>I am working on upgrading an Angular 1 app to Angular 2 using <code>@angular/upgrade</code>. For the most part this has gone well. I now have an Angular 2 component that works within my Angular 1 app when manually testing.</p>
  
  <p>However, so far I've been unable to successfully unit test the Angular 2 component. My code looks like the following:</p>
  
  <p>app.ts</p>
  
  <pre><code>import "./polyfills";
  import "./app.helpers";
  import * as angular from "angular";
  import "reflect-metadata";
  import {UpgradeAdapter, UpgradeAdapterRef} from "@angular/upgrade";
  import { NgModule } from "@angular/core";
  import {BrowserModule} from "@angular/platform-browser";
  
  import {initRoutes} from "./app.routes";
  import {initComponents, components} from "./app.components";
  import {initServices, services} from "./app.services";
  import {initHttpConfig} from "./app.http-config";
  
  @NgModule({
      imports: [BrowserModule],
      declarations: [].concat(components),
      providers: [].concat(services)
  })
  class AppModule {}
  
  export const upgradeAdapter = new UpgradeAdapter(AppModule);
  
  const app = angular.module("App", [/*ng1 modules*/]);
  
  initHttpConfig(app);
  initRoutes(app);
  initComponents(app);
  initServices(app);
  
  angular.element(document).ready(() =&gt; {
      upgradeAdapter.bootstrap(document.body, ["App"]);
  });
  
  export default app;
  export const ng = angular;
  </code></pre>
  
  <p>spec-entry.ts</p>
  
  <pre><code>import "./polyfills";
  import "zone.js/dist/long-stack-trace-zone";
  import "zone.js/dist/proxy.js";
  import "zone.js/dist/sync-test";
  import "zone.js/dist/jasmine-patch";
  import "zone.js/dist/async-test";
  import "zone.js/dist/fake-async-test";
  import {getTestBed} from "@angular/core/testing";
  import {BrowserTestingModule, platformBrowserTesting} from "@angular/platform-browser/testing";
  
  getTestBed().initTestEnvironment(BrowserTestingModule, platformBrowserTesting());
  
  interface WebpackRequire extends NodeRequire {
      context(dir: string, includeSubdirs: boolean, matchFiles: RegExp) : any;
  }
  
  const wpRequire = require as WebpackRequire;
  
  const testsContext = wpRequire.context(".", true, /\.spec\.ts$/);
  testsContext.keys().forEach(testsContext);
  </code></pre>
  
  <p>my-component.ts</p>
  
  <pre><code>import "../app.ts";
  import {
      async,
      inject,
      TestBed,
  } from "@angular/core/testing";
  import * as moment from "moment";
  import {CollegeEvent} from "../models/college-event.model";
  import {MyComponent} from "./my.component";
  
  describe("My component", function () {
      let fixture;
      let component;
      beforeEach(() =&gt; {
          TestBed.configureTestingModule({
              declarations: [MyComponent],
          });
  
          fixture = TestBed.createComponent(MyComponent);
          component = fixture.debugElement.componentInstance;
      });
  
      it("should not throw an error", () =&gt; {
  
      });
  });
  </code></pre>
  
  <p>When running my tests I receive the following error:</p>
  
  <pre><code>1) Error: No provider for TestingCompilerFactory!
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>