test(upgrade): fail tests when there are AngularJS errors (#18209)

This commit is contained in:
Georgios Kalpakas 2017-07-20 00:52:49 +03:00 committed by Miško Hevery
parent d31dc7b2b3
commit 6d7799fce9
1 changed files with 7 additions and 4 deletions

View File

@ -15,11 +15,14 @@ export * from '../common/test_helpers';
export function bootstrap( export function bootstrap(
platform: PlatformRef, Ng2Module: Type<{}>, element: Element, ng1Module: angular.IModule) { platform: PlatformRef, Ng2Module: Type<{}>, element: Element, ng1Module: angular.IModule) {
// We bootstrap the Angular module first; then when it is ready (async) // We bootstrap the Angular module first; then when it is ready (async) we bootstrap the AngularJS
// We bootstrap the AngularJS module on the bootstrap element // module on the bootstrap element (also ensuring that AngularJS errors will fail the test).
return platform.bootstrapModule(Ng2Module).then(ref => { return platform.bootstrapModule(Ng2Module).then(ref => {
const upgrade = ref.injector.get<UpgradeModule>(UpgradeModule); const upgrade = ref.injector.get(UpgradeModule);
upgrade.bootstrap(element, [ng1Module.name]); const failHardModule: any = ($provide: angular.IProvideService) => {
$provide.value('$exceptionHandler', (err: any) => { throw err; });
};
upgrade.bootstrap(element, [failHardModule, ng1Module.name]);
return upgrade; return upgrade;
}); });
} }