Following test fails as expected (http://plnkr.co/edit/61ByTt?p=preview):
@Component({
selector: 'header',
template: '<h1>Hello Welt!</h1>'
})
export class TestComponent2 {
}
describe('TestComponent', () => {
it('should fail', inject([TestComponentBuilder], (tcb) => {
return tcb.createAsync(TestComponent2).then((fixture) => {
fixture.detectChanges();
expect(1).toEqual(2);
});
}));
)};
Moving the template to an external resource, the test passes without failing (the async part doesn't get executed) (http://plnkr.co/edit/ZOeFTO?p=preview):
@Component({
selector: 'header',
templateUrl: 'src/test.html'
})
export class TestComponent {
}
describe('TestComponent', () => {
it('should fail', inject([TestComponentBuilder], (tcb) => {
return tcb.createAsync(TestComponent).then((fixture) => {
fixture.detectChanges();
expect(1).toEqual(2);
});
}));
)};
Following test fails as expected (http://plnkr.co/edit/61ByTt?p=preview):
Moving the template to an external resource, the test passes without failing (the async part doesn't get executed) (http://plnkr.co/edit/ZOeFTO?p=preview):