1
votes

I've just picked up a new code base (Angular8), and I get this error when running unit tests.

ERROR: Error: Uncaught (in promise): [object Window] Error: Uncaught (in promise): [object Window] at resolvePromise (http://localhost:9876/karma_webpack/node_modules/zone.js/dist/zone-evergreen.js:797:1) at resolvePromise (http://localhost:9876/karma_webpack/node_modules/zone.js/dist/zone-evergreen.js:754:1) at http://localhost:9876/karma_webpack/node_modules/zone.js/dist/zone-evergreen.js:858:1 at ZoneDelegate.invokeTask (http://localhost:9876/karma_webpack/node_modules/zone.js/dist/zone-evergreen.js:391:1) at ProxyZoneSpec.push../node_modules/zone.js/dist/zone-testing.js.ProxyZoneSpec.onInvokeTask (http://localhost:9876/karma_webpack/node_modules/zone.js/dist/zone-testing.js:339:1) at ZoneDelegate.invokeTask (http://localhost:9876/karma_webpack/node_modules/zone.js/dist/zone-evergreen.js:390:1) at Zone.runTask (http://localhost:9876/karma_webpack/node_modules/zone.js/dist/zone-evergreen.js:168:1) at drainMicroTaskQueue (http://localhost:9876/karma_webpack/node_modules/zone.js/dist/zone-evergreen.js:559:1) at invokeTask (http://localhost:9876/karma_webpack/node_modules/zone.js/dist/zone-evergreen.js:469:1)

I have no idea which of the 500+ unit tests are failing. The stack trace doesn't mention any user code. Where do I look? Are there other ways of running the tests (I use ng test) that will give more information?

1

1 Answers

1
votes

karma-mocha-reporter would help you. It prints out the console logs before the expectations results. In this way, you can easily track which console message (including the error messages) was printed by each test.