Skip to content

Commit f09439c

Browse files
rene-leanixfilipesilva
authored andcommitted
fix(test): catches module loading errors
Fixes #2640 Close #2785
1 parent 71423a1 commit f09439c

File tree

1 file changed

+10
-1
lines changed
  • packages/angular-cli/blueprints/ng2/files/__path__

1 file changed

+10
-1
lines changed

packages/angular-cli/blueprints/ng2/files/__path__/test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ Promise.all([
2929
// Then we find all the tests.
3030
.then(() => require.context('./', true, /\.spec\.ts/))
3131
// And load the modules.
32-
.then(context => context.keys().map(context))
32+
.then(context => {
33+
try {
34+
return context.keys().map(context);
35+
} catch (e) {
36+
if (console) {
37+
console.error(e.message, e.stack);
38+
}
39+
throw e;
40+
}
41+
})
3342
// Finally, start Karma to run the tests.
3443
.then(__karma__.start, __karma__.error);

0 commit comments

Comments
 (0)