2

I have a problem with tests - when running multiple tests one of them fails, but when I isolate them and run one at the time, they all pass. Tests are basic placeholders (I'm working on seed project) and typically look like this:

import {inject, injectAsync, TestComponentBuilder, beforeEachProviders} from 'angular2/testing'
import {describe, ddescribe, it, iit, expect} from 'angular2/testing'
import {provide} from 'angular2/core'
import {PeopleComponent} from './people.component'

describe('PeopleComponent', () => {
  beforeEachProviders(() => []);
  it('should ...', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
    return tcb.createAsync(PeopleComponent).then((fixture) => {
      fixture.detectChanges();
    });
  }));
});

When I change describe to ddescribe in any of the tests, they pass. I can't figure out why. Any ideas?

Full Error trace is below:

Chrome 47.0.2526 (Windows 10 0.0.0) DebugDirective should compile in component template FAILED
    Failed: The selector "#root0" did not match any elements
    Error: The selector "#root0" did not match any elements
        at new BaseException (C:/~/node_modules/angular2/bundles/angular2.dev.js:8080:21)
        at DomRenderer_.createRootHostView (C:/~/node_modules/angular2/bundles/angular2.dev.js:15248:15)
        at AppViewManager_.createRootHostView (C:/~/node_modules/angular2/bundles/angular2.dev.js:11265:52)
        at C:/~/node_modules/angular2/bundles/angular2.dev.js:14531:46
        at Zone.run (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:138:17)
        at Zone.run (C:/~/node_modules/angular2/bundles/testing.dev.js:2544:30)
        at zoneBoundFn (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:111:19)
        at lib$es6$promise$$internal$$tryCatch (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:1511:16)
        at lib$es6$promise$$internal$$invokeCallback (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:1523:17)
        at lib$es6$promise$$internal$$publish (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:1494:11)
        at C:/~/node_modules/angular2/bundles/angular2-polyfills.js:243:5
        at microtask (C:/~/node_modules/angular2/bundles/testing.dev.js:2557:15)
        at Zone.run (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:138:17)
        at Zone.run (C:/~/node_modules/angular2/bundles/testing.dev.js:2544:30)
        at zoneBoundFn (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:111:19)
        at lib$es6$promise$asap$$flush (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:1305:9)
    Failed: Cannot read property 'hostView' of undefined
    TypeError: Cannot read property 'hostView' of undefined
        at new ComponentFixture_ (C:/~/node_modules/angular2/bundles/testing.dev.js:2047:97)
        at C:/~/node_modules/angular2/bundles/testing.dev.js:2145:16
        at Zone.run (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:138:17)
        at Zone.run (C:/~/node_modules/angular2/bundles/testing.dev.js:2544:30)
        at zoneBoundFn (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:111:19)
        at lib$es6$promise$$internal$$tryCatch (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:1511:16)
        at lib$es6$promise$$internal$$invokeCallback (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:1523:17)
        at lib$es6$promise$$internal$$publish (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:1494:11)
        at C:/~/node_modules/angular2/bundles/angular2-polyfills.js:243:5
        at microtask (C:/~/node_modules/angular2/bundles/testing.dev.js:2557:15)
        at Zone.run (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:138:17)
        at Zone.run (C:/~/node_modules/angular2/bundles/testing.dev.js:2544:30)
        at zoneBoundFn (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:111:19)
        at lib$es6$promise$asap$$flush (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:1305:9)
    Failed: Cannot read property 'detectChanges' of undefined
    TypeError: Cannot read property 'detectChanges' of undefined
        at C:/~/dist/scripts/core/components/people/people.component.spec.js:17:32
        at C:/~/dist/scripts/core/components/people/people.component.spec.js:17:32
        at Zone.run (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:138:17)
        at Zone.run (C:/~/node_modules/angular2/bundles/testing.dev.js:2544:30)
        at zoneBoundFn (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:111:19)
        at lib$es6$promise$$internal$$tryCatch (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:1511:16)
        at lib$es6$promise$$internal$$invokeCallback (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:1523:17)
        at lib$es6$promise$$internal$$publish (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:1494:11)
        at C:/~/node_modules/angular2/bundles/angular2-polyfills.js:243:5
        at microtask (C:/~/node_modules/angular2/bundles/testing.dev.js:2557:15)
        at Zone.run (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:138:17)
        at Zone.run (C:/~/node_modules/angular2/bundles/testing.dev.js:2544:30)
        at zoneBoundFn (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:111:19)
        at lib$es6$promise$asap$$flush (C:/~/node_modules/angular2/bundles/angular2-polyfills.js:1305:9)
Chrome 47.0.2526 (Windows 10 0.0.0): Executed 16 of 16 (1 FAILED) (0.396 secs / 0.167 secs)
Sasxa
  • 40,334
  • 16
  • 88
  • 102
  • 2
    There's currently a [bug using templateUrl](https://github.com/angular/angular/issues/5662), so remove it from your component. You can use `template` property or `overrideTemplate` until it's fixed. – Eric Martinez Dec 28 '15 at 01:02
  • @EricMartinez Cheers! `overrideTemplate` in component tests solved the issue. Thanks. – Sasxa Dec 28 '15 at 01:09

0 Answers0