Skip to content

Instantly share code, notes, and snippets.

@matthewdenobrega
Created January 4, 2016 10:47
Show Gist options
  • Save matthewdenobrega/35d6abd5011f348f04e0 to your computer and use it in GitHub Desktop.
Save matthewdenobrega/35d6abd5011f348f04e0 to your computer and use it in GitHub Desktop.
Unit tests fail silently on exception in tcb.createAsync.then function
import {ComponentFixture, describe, expect, inject, it, TestComponentBuilder} from 'angular2/testing'
import {Component, View} from 'angular2/src/core/metadata'
@Component({ selector: 'basic-component' })
@View({ template: '<div></div>' })
class BasicComponent { }
// Set up the browser adapter
import {BrowserDomAdapter} from 'angular2/src/platform/browser/browser_adapter'
BrowserDomAdapter.makeCurrent()
describe('BasicComponent', () => {
it('should create a new component', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
tcb.createAsync(BasicComponent).then((fixture: ComponentFixture) => {
expect(fixture.debugElement).not.toBe(null)
throw ('exception')
expect(false).toBe(true)
})
}))
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment