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 <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
This commit is contained in:
Chris Henney 2016-12-01 10:37:18 -06:00 committed by Rich Trott
parent e4b88d10b7
commit 25dfb8e570

View File

@ -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');
});