From 25dfb8e5708a3bdd14697c11ffd2a38ac73072f7 Mon Sep 17 00:00:00 2001 From: Chris Henney Date: Thu, 1 Dec 2016 10:37:18 -0600 Subject: [PATCH] test: refactor test-domain-exit-dispose change equal to strictEqual, fix setTimeout PR-URL: https://github.com/nodejs/node/pull/9938 Reviewed-By: James M Snell Reviewed-By: Michael Dawson Reviewed-By: Luigi Pinca Reviewed-By: Jeremiah Senkpiel --- test/parallel/test-domain-exit-dispose.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-domain-exit-dispose.js b/test/parallel/test-domain-exit-dispose.js index 94b3dbd4ca5a37..508cec18dccb7d 100644 --- a/test/parallel/test-domain-exit-dispose.js +++ b/test/parallel/test-domain-exit-dispose.js @@ -1,8 +1,8 @@ 'use strict'; require('../common'); +var common = require('../common'); var assert = require('assert'); var domain = require('domain'); -var disposalFailed = false; // no matter what happens, we should increment a 10 times. var a = 0; @@ -22,11 +22,7 @@ function err() { function err2() { // this timeout should never be called, since the domain gets // disposed when the error happens. - setTimeout(function() { - console.error('This should not happen.'); - disposalFailed = true; - process.exit(1); - }); + setTimeout(common.mustCall(() => {}, 0), 1); // this function doesn't exist, and throws an error as a result. err3(); // eslint-disable-line no-undef @@ -41,7 +37,6 @@ function err() { } process.on('exit', function() { - assert.equal(a, 10); - assert.equal(disposalFailed, false); + assert.strictEqual(a, 10); console.log('ok'); });