From 1bb49f545fa4e472613890399b73b072ecbab01e Mon Sep 17 00:00:00 2001 From: Rene Hamburger Date: Wed, 19 Oct 2016 16:56:39 +0200 Subject: [PATCH] Catches & logs errors in module loading in ng2's test.ts Fixes #2640 --- .../angular-cli/blueprints/ng2/files/__path__/test.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/angular-cli/blueprints/ng2/files/__path__/test.ts b/packages/angular-cli/blueprints/ng2/files/__path__/test.ts index 7727c8e6f802..829cc5f934bd 100644 --- a/packages/angular-cli/blueprints/ng2/files/__path__/test.ts +++ b/packages/angular-cli/blueprints/ng2/files/__path__/test.ts @@ -29,6 +29,15 @@ Promise.all([ // Then we find all the tests. .then(() => require.context('./', true, /\.spec\.ts/)) // And load the modules. - .then(context => context.keys().map(context)) + .then(context => { + try { + return context.keys().map(context); + } catch (e) { + if (console) { + console.error(e.message, e.stack); + } + throw e; + } + }) // Finally, start Karma to run the tests. .then(__karma__.start, __karma__.error);