From 557d62269eb273309b7805149aaaf45d6eed0178 Mon Sep 17 00:00:00 2001 From: Adam Plumer Date: Sun, 11 Feb 2018 14:16:31 -0500 Subject: [PATCH] build: fix runtime errors not being logged out on karma initialization * Equivalent commit to angular/material#9888 --- test/karma-test-shim.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/karma-test-shim.js b/test/karma-test-shim.js index 5723460f0..9cb1f1044 100644 --- a/test/karma-test-shim.js +++ b/test/karma-test-shim.js @@ -83,9 +83,15 @@ System.config({ }); // Configure the Angular test bed and run all specs once configured. - configureTestBed() +configureTestBed() .then(runSpecs) - .then(__karma__.start, __karma__.error); + .then(__karma__.start, function(error) { + // Passing in the error object directly to Karma won't log out the stack trace and + // passing the `originalErr` doesn't work correctly either. We have to log out the + // stack trace so we can actually debug errors before the tests have started. + console.error(error.originalErr.stack); + __karma__.error(error); + }); /** Runs the specs in Karma. */