Browse Source

test: refactor test-domain.js

apply setTimeout duration, add const, remove unused var

PR-URL: https://github.com/nodejs/node/pull/10207
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
v6
Siddhartha Sahai 8 years ago
committed by Rich Trott
parent
commit
ca58e53047
  1. 16
      test/parallel/test-domain.js

16
test/parallel/test-domain.js

@ -2,10 +2,10 @@
// Simple tests of most basic domain functionality. // Simple tests of most basic domain functionality.
require('../common'); require('../common');
var assert = require('assert'); const assert = require('assert');
var domain = require('domain'); const domain = require('domain');
var events = require('events'); const events = require('events');
var fs = require('fs'); const fs = require('fs');
var caught = 0; var caught = 0;
var expectCaught = 0; var expectCaught = 0;
@ -137,8 +137,8 @@ d.run(function() {
// pretty common error. // pretty common error.
console.log(stat.isDirectory()); console.log(stat.isDirectory());
}); });
}); }, 1);
}); }, 1);
}); });
}); });
expectCaught++; expectCaught++;
@ -148,7 +148,7 @@ expectCaught++;
d.run(function() { d.run(function() {
setTimeout(function() { setTimeout(function() {
throw new Error('implicit timer'); throw new Error('implicit timer');
}); }, 1);
}); });
expectCaught++; expectCaught++;
@ -162,7 +162,7 @@ expectCaught++;
// get rid of the `if (er) return cb(er)` malarky, by intercepting // get rid of the `if (er) return cb(er)` malarky, by intercepting
// the cb functions to the domain, and using the intercepted function // the cb functions to the domain, and using the intercepted function
// as a callback instead. // as a callback instead.
function fn(er) { function fn() {
throw new Error('This function should never be called!'); throw new Error('This function should never be called!');
} }

Loading…
Cancel
Save