Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fakeAsync is not working with webpack #590

Closed
frickt opened this issue May 16, 2016 · 3 comments
Closed

fakeAsync is not working with webpack #590

frickt opened this issue May 16, 2016 · 3 comments
Labels

Comments

@frickt
Copy link

frickt commented May 16, 2016

I've extended the app.spec.ts with a fakeAsync test.

import {
  it,
  inject,
  beforeEachProviders,
  fakeAsync,
  tick
} from '@angular/core/testing';
import {Control} from '@angular/common';

// Load the implementations that should be tested
import {App} from './app.component';
import {AppState} from './app.service';

describe('App', () => {
  // provide our implementations or mocks to the dependency injector
  beforeEachProviders(() => [
    AppState,
    App
  ]);

  it('should have a url', inject([ App ], (app) => {
    expect(app.url).toEqual('https://twitter.com/AngularClass');
  }));

  it("should rerun the validator when the value changes", fakeAsync(() => {
    var c = new Control("value");

    c.updateValue("expected");
    tick();

    expect(c.valid).toEqual(true);
  }));

});

and got the exception:

TypeError: undefined is not a constructor (evaluating 'new _FakeAsyncTestZoneSpecType()') in /Users/thomasfrick/git/angular2-webpack-starter/config/spec-bundle.js (line 23143)
    fakeAsync@/Users/thomasfrick/git/angular2-webpack-starter/config/spec-bundle.js:23143:64 <- webpack:///~/@angular/core/testing/fake_async.js:24:0
    /Users/thomasfrick/git/angular2-webpack-starter/config/spec-bundle.js:63422:91 <- webpack:///src/app/app.spec.ts:25:68
    /Users/thomasfrick/git/angular2-webpack-starter/config/spec-bundle.js:63413:10 <- webpack:///src/app/app.spec.ts:14:9
    __webpack_require__@/Users/thomasfrick/git/angular2-webpack-starter/config/spec-bundle.js:48:34 <- webpack:/webpack/bootstrap c3d4bc0d96fddcbb67fd:47:0
    webpackContext@/Users/thomasfrick/git/angular2-webpack-starter/config/spec-bundle.js:63353:29 <- webpack:/src \.spec\.ts:10:0
    map@[native code]
    requireAll@/Users/thomasfrick/git/angular2-webpack-starter/config/spec-bundle.js:153:36 <- webpack:///config/spec-bundle.js:56:0
    /Users/thomasfrick/git/angular2-webpack-starter/config/spec-bundle.js:157:26 <- webpack:///config/spec-bundle.js:60:0
    /Users/thomasfrick/git/angular2-webpack-starter/config/spec-bundle.js:159:35 <- null:0:0
    __webpack_require__@/Users/thomasfrick/git/angular2-webpack-starter/config/spec-bundle.js:48:34 <- webpack:/webpack/bootstrap c3d4bc0d96fddcbb67fd:47:0
    /Users/thomasfrick/git/angular2-webpack-starter/config/spec-bundle.js:91:37 <- webpack:/webpack/bootstrap c3d4bc0d96fddcbb67fd:90:0
    global code@/Users/thomasfrick/git/angular2-webpack-starter/config/spec-bundle.js:92:12 <- null:0:0

is there an import I miss?

@abdulhaq-e
Copy link
Contributor

I can confirm this.

@abdulhaq-e
Copy link
Contributor

Should be solved when #609 gets merged.

@ebeal ebeal added the bug label May 19, 2016
@PatrickJS
Copy link
Owner

done via #609

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants