From 6d7799fce9e951f54b42ac4b297aa7e4721f8baa Mon Sep 17 00:00:00 2001 From: Georgios Kalpakas Date: Thu, 20 Jul 2017 00:52:49 +0300 Subject: [PATCH] test(upgrade): fail tests when there are AngularJS errors (#18209) --- packages/upgrade/test/static/test_helpers.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/upgrade/test/static/test_helpers.ts b/packages/upgrade/test/static/test_helpers.ts index 31beafe518..a384f7e9cd 100644 --- a/packages/upgrade/test/static/test_helpers.ts +++ b/packages/upgrade/test/static/test_helpers.ts @@ -15,11 +15,14 @@ export * from '../common/test_helpers'; export function bootstrap( platform: PlatformRef, Ng2Module: Type<{}>, element: Element, ng1Module: angular.IModule) { - // We bootstrap the Angular module first; then when it is ready (async) - // We bootstrap the AngularJS module on the bootstrap element + // We bootstrap the Angular module first; then when it is ready (async) we bootstrap the AngularJS + // module on the bootstrap element (also ensuring that AngularJS errors will fail the test). return platform.bootstrapModule(Ng2Module).then(ref => { - const upgrade = ref.injector.get(UpgradeModule); - upgrade.bootstrap(element, [ng1Module.name]); + const upgrade = ref.injector.get(UpgradeModule); + const failHardModule: any = ($provide: angular.IProvideService) => { + $provide.value('$exceptionHandler', (err: any) => { throw err; }); + }; + upgrade.bootstrap(element, [failHardModule, ng1Module.name]); return upgrade; }); }