Skip to content

Commit a64f406

Browse files
Chris HenneyMylesBorins
Chris Henney
authored andcommitted
test: refactor test-domain-exit-dispose
change equal to strictEqual, fix setTimeout PR-URL: #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>
1 parent a896d4e commit a64f406

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22
require('../common');
3+
var common = require('../common');
34
var assert = require('assert');
45
var domain = require('domain');
5-
var disposalFailed = false;
66

77
// no matter what happens, we should increment a 10 times.
88
var a = 0;
@@ -22,11 +22,7 @@ function err() {
2222
function err2() {
2323
// this timeout should never be called, since the domain gets
2424
// disposed when the error happens.
25-
setTimeout(function() {
26-
console.error('This should not happen.');
27-
disposalFailed = true;
28-
process.exit(1);
29-
});
25+
setTimeout(common.mustCall(() => {}, 0), 1);
3026

3127
// this function doesn't exist, and throws an error as a result.
3228
err3(); // eslint-disable-line no-undef
@@ -41,7 +37,6 @@ function err() {
4137
}
4238

4339
process.on('exit', function() {
44-
assert.equal(a, 10);
45-
assert.equal(disposalFailed, false);
40+
assert.strictEqual(a, 10);
4641
console.log('ok');
4742
});

0 commit comments

Comments
 (0)