Browse Source

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>
v6
Chris Henney 8 years ago
committed by Rich Trott
parent
commit
25dfb8e570
  1. 11
      test/parallel/test-domain-exit-dispose.js

11
test/parallel/test-domain-exit-dispose.js

@ -1,8 +1,8 @@
'use strict'; 'use strict';
require('../common'); require('../common');
var common = require('../common');
var assert = require('assert'); var assert = require('assert');
var domain = require('domain'); var domain = require('domain');
var disposalFailed = false;
// no matter what happens, we should increment a 10 times. // no matter what happens, we should increment a 10 times.
var a = 0; var a = 0;
@ -22,11 +22,7 @@ function err() {
function err2() { function err2() {
// this timeout should never be called, since the domain gets // this timeout should never be called, since the domain gets
// disposed when the error happens. // disposed when the error happens.
setTimeout(function() { setTimeout(common.mustCall(() => {}, 0), 1);
console.error('This should not happen.');
disposalFailed = true;
process.exit(1);
});
// this function doesn't exist, and throws an error as a result. // this function doesn't exist, and throws an error as a result.
err3(); // eslint-disable-line no-undef err3(); // eslint-disable-line no-undef
@ -41,7 +37,6 @@ function err() {
} }
process.on('exit', function() { process.on('exit', function() {
assert.equal(a, 10); assert.strictEqual(a, 10);
assert.equal(disposalFailed, false);
console.log('ok'); console.log('ok');
}); });

Loading…
Cancel
Save