Skip to content

Commit a436bb8

Browse files
committed
Don't suppress uncaughtException
1 parent 0261a0a commit a436bb8

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

index.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -257,23 +257,18 @@ function enableEachHooks(context) {
257257

258258
/**
259259
* Removes mocha's uncaughtException handler, allowing exceptions to be handled
260-
* by domains during parallel spec execution.
260+
* by domains during parallel spec execution, and all others to terminate the
261+
* process.
261262
*
262263
* @returns {function} Function that restores mocha's uncaughtException listener
263264
*/
264265
function patchUncaught() {
265266
var name = 'uncaughtException';
266267
var originalListener = process.listeners(name).pop();
267268

268-
var listener = function(err) {
269-
// noop
270-
};
271-
272269
process.removeListener(name, originalListener);
273-
process.on(name, listener);
274270

275271
return function() {
276-
process.removeListener(name, listener);
277272
process.on(name, originalListener);
278273
};
279274
}

0 commit comments

Comments
 (0)