From 6df98c15a74db835c2b9d98e9f92829bec51feaf Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 8 Dec 2016 22:26:28 -0800 Subject: [PATCH] test: refactor test-handle-wrap-close-abort * use common.mustCall() to confirm number of uncaught exceptions * var -> const * specify duration of 1ms for setTimeout() and setInterval() --- test/parallel/test-handle-wrap-close-abort.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-handle-wrap-close-abort.js b/test/parallel/test-handle-wrap-close-abort.js index 8572668f666864..78a51482f22cf1 100644 --- a/test/parallel/test-handle-wrap-close-abort.js +++ b/test/parallel/test-handle-wrap-close-abort.js @@ -1,16 +1,19 @@ 'use strict'; -require('../common'); +const common = require('../common'); -process.on('uncaughtException', function() { }); +function noop() {} +const uncaughtExceptionHandler = common.mustCall(noop, 2); + +process.on('uncaughtException', uncaughtExceptionHandler); setTimeout(function() { process.nextTick(function() { - var c = setInterval(function() { + const c = setInterval(function() { clearInterval(c); throw new Error('setInterval'); - }); + }, 1); }); setTimeout(function() { throw new Error('setTimeout'); - }); + }, 1); });