title: Angular 2: "Unknown Provider: $$angularInjectorProvider" when unit testing with an `UpgradeModule` downgraded service
body: <p>Our app currently has some 4,500+ existing Angular 1 tests. We're now incorporating Angular 2 using <code>UpgradeModule</code> to downgrade an Angular 2 service, which is used from our app's run() method. This causes all tests to fail with a <code>Error: [$injector:unpr] Unknown Provider $$angularInjectorProvider</code> error.</p>
  
  <p>I created a plnkr to demonstrate this issue (<a href="http://plnkr.co/edit/XuMYBr9xInqq18Kr6EAs?p=preview">http://plnkr.co/edit/XuMYBr9xInqq18Kr6EAs?p=preview</a>). </p>
  
  <p>Basically the Angular 1 module looks like this:</p>
  
  <pre><code>// angular1.module.ts
  
  angular.module( 'testApp' )
      .run( [ 'Angular2Service', Angular2Service =&gt; {  // injecting downgraded service
          Angular2Service.showTestMessage();
      } ] );
  </code></pre>
  
  <p>Where <code>Angular2Service</code> is downgraded with:</p>
  
  <pre><code>// app.module.ts
  
  angular.module( 'testApp' )
      .factory( 'Angular2Service', downgradeInjectable( Angular2Service ) );
  
  
  @NgModule({
      imports: [ BrowserModule, UpgradeModule ],
      providers : [ Angular2Service ]
  })
  export class AppModule {
      ngDoBootstrap() {}
  }
  </code></pre>
  
  <p>Originally with this so far, I was getting an Unknown Provider error for <code>'Angular2Service'</code> itself when the tests executed, so I added a <code>beforeEach()</code> that compiles everything in <code>AppModule</code>:</p>
  
  <pre><code>beforeEach( async( () =&gt; {
      TestBed.configureTestingModule( {
          imports : [ AppModule ]
      } )
          .compileComponents();
  } ) );
  </code></pre>
  
  <p>And that's where I'm at with the <code>Error: [$injector:unpr] Unknown Provider $$angularInjectorProvider</code> error. </p>
  
  <p>The test itself that is executing is purely an Angular 1 test, which passes if I don't inject <code>Angular2Service</code> into the run() method:</p>
  
  <pre><code>describe( 'testComponent', () =&gt; {
      var $compile,
          $scope;
  
      beforeEach( module( 'testApp' ) );
  
      beforeEach( inject( $injector =&gt; {
          $compile = $injector.get( '$compile' );
          $scope = $injector.get( '$rootScope' ).$new();
      } ) );
  
  
      it( 'should show the text "Test Component" in the DOM', () =&gt; {
          var element = $compile( '&lt;test-component&gt;&lt;/test-component&gt;' )( $scope );
          $scope.$apply();
  
          expect( element[ 0 ].innerHTML ).toBe( 'Test Component' );
      } );
  
  } );
  </code></pre>
  
  <p>I'm hoping that this can be fixed so that all of our pure Angular 1 tests can continue to work unchanged, but I can update them too if need be. Any help on this would be greatly appreciated!</p>
  
  <p><a href="http://plnkr.co/edit/XuMYBr9xInqq18Kr6EAs?p=preview">http://plnkr.co/edit/XuMYBr9xInqq18Kr6EAs?p=preview</a></p>