Update to update: Beta.3 fixed the issue that Günter Zöchbauer mentioned, we can now use injectAsync, which didn't work before. I also suggest using this:
import {setBaseTestProviders} from 'angular2/testing'; import {getTestInjector} from 'angular2/testing'; import {TEST_BROWSER_PLATFORM_PROVIDERS, TEST_BROWSER_APPLICATION_PROVIDERS } from 'angular2/platform/testing/browser'; if (getTestInjector().platformProviders.length === 0 || getTestInjector().applicationProviders.length === 0) { setBaseTestProviders(TEST_BROWSER_PLATFORM_PROVIDERS, TEST_BROWSER_APPLICATION_PROVIDERS); }
otherwise, you will receive an error when loading BaseTestProviders a second time.
source share