Skip to content

Commit

Permalink
test: refactor test-domain-exit-dispose
Browse files Browse the repository at this point in the history
change equal to strictEqual, fix setTimeout

PR-URL: #9938
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
  • Loading branch information
Chris Henney authored and addaleax committed Dec 8, 2016
1 parent 5ca9077 commit de99726
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions test/parallel/test-domain-exit-dispose.js
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand All @@ -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');
});

0 comments on commit de99726

Please sign in to comment.