From e8bf30a1d09ffd81c56c2a4c73dc5f5ca013e083 Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Wed, 16 Aug 2017 12:50:11 +0200 Subject: [PATCH] log errors if they escape us --- packages/jest-jasmine2/src/jasmine/Env.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/jest-jasmine2/src/jasmine/Env.js b/packages/jest-jasmine2/src/jasmine/Env.js index c689072e46b6..830f07b9c691 100644 --- a/packages/jest-jasmine2/src/jasmine/Env.js +++ b/packages/jest-jasmine2/src/jasmine/Env.js @@ -188,18 +188,13 @@ module.exports = function(j$) { } const uncaught = err => { - let name; - let current; if (currentSpec) { - current = currentSpec; - name = current.getFullName(); - current.onException(err); - current.cancel(); - // TODO: how to cancel the current running spec + currentSpec.onException(err); + currentSpec.cancel(); } else { - // TODO: Handle top level failures + console.error('Unhandled error'); + console.error(err.stack); } - // console.error('caught in ' + name); }; process.on('uncaughtException', uncaught);