summaryrefslogtreecommitdiff
path: root/test/parallel/test-exception-handler.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-exception-handler.js')
-rw-r--r--test/parallel/test-exception-handler.js18
1 files changed, 5 insertions, 13 deletions
diff --git a/test/parallel/test-exception-handler.js b/test/parallel/test-exception-handler.js
index 735daa5107..d163fb1891 100644
--- a/test/parallel/test-exception-handler.js
+++ b/test/parallel/test-exception-handler.js
@@ -1,27 +1,19 @@
'use strict';
-require('../common');
+const common = require('../common');
var assert = require('assert');
var MESSAGE = 'catch me if you can';
-var caughtException = false;
-process.on('uncaughtException', function(e) {
+process.on('uncaughtException', common.mustCall(function(e) {
console.log('uncaught exception! 1');
assert.equal(MESSAGE, e.message);
- caughtException = true;
-});
+}));
-process.on('uncaughtException', function(e) {
+process.on('uncaughtException', common.mustCall(function(e) {
console.log('uncaught exception! 2');
assert.equal(MESSAGE, e.message);
- caughtException = true;
-});
+}));
setTimeout(function() {
throw new Error(MESSAGE);
}, 10);
-
-process.on('exit', function() {
- console.log('exit');
- assert.equal(true, caughtException);
-});