title: Angular2 testing with fakeAsync
body: <p>I'm trying to use fakeAsync to test an Angular 2 component, but the fixture variable is not being set. In fact, the promise callback is not being called. Here is the code: </p>
  
        
  
  <pre class="lang-ts prettyprint-override"><code>@Component({
    template: '',
    directives: [GroupBox, GroupBoxHeader]
  })
  class TestComponent {
    expandedCallback() { this.expandedCalled = true; }
  }
  
  it('testing...', inject([TestComponentBuilder], fakeAsync((tcb) =&gt; {
  
    var fixture;
  
    tcb.createAsync(TestComponent).then((rootFixture) =&gt; {
      fixture = rootFixture
    });
  
    tick();
  
    fixture.detectChanges();
  })));
  </code></pre>
  
  <p>When I run this code, I get: </p>
  
  <blockquote>
    <p>Failed: Cannot read property 'detectChanges' of undefined
            TypeError: Cannot read property 'detectChanges' of undefined</p>
  </blockquote>
  
  <p>I can't figure out why the callback isn't fired. In this repository, it works fine: <a href="https://github.com/juliemr/ng2-test-seed/blob/master/src/test/greeting-component_test.ts" rel="nofollow">https://github.com/juliemr/ng2-test-seed/blob/master/src/test/greeting-component_test.ts</a> </p>
  
  <p>Any clue?</p>
  
  <p>Note: I'm using ES6, Traceur, Angular 2 beta, Karma and Jasmine.</p>
  
  <p>------ UPDATE ------</p>
  
  <p>It follows a repository with the failing test:</p>
  
  <p><a href="https://github.com/cangosta/ng2_testing_fakeasync" rel="nofollow">https://github.com/cangosta/ng2_testing_fakeasync</a></p>