mirror of
https://github.com/nodejs/node.git
synced 2025-05-09 23:06:47 +00:00

Enable linting for the test directory. A number of changes was made so all tests conform the current rules used by lib and src directories. The only exception for tests is that unreachable (dead) code is allowed. test-fs-non-number-arguments-throw had to be excluded from the changes because of a weird issue on Windows CI. PR-URL: https://github.com/nodejs/io.js/pull/1721 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
41 lines
872 B
JavaScript
41 lines
872 B
JavaScript
'use strict';
|
|
var domain = require('domain');
|
|
var assert = require('assert');
|
|
var common = require('../common');
|
|
|
|
var timeout_err, timeout, immediate_err;
|
|
|
|
var timeoutd = domain.create();
|
|
|
|
timeoutd.on('error', function(e) {
|
|
timeout_err = e;
|
|
clearTimeout(timeout);
|
|
});
|
|
|
|
timeoutd.run(function() {
|
|
setTimeout(function() {
|
|
throw new Error('Timeout UNREFd');
|
|
}).unref();
|
|
});
|
|
|
|
var immediated = domain.create();
|
|
|
|
immediated.on('error', function(e) {
|
|
immediate_err = e;
|
|
});
|
|
|
|
immediated.run(function() {
|
|
setImmediate(function() {
|
|
throw new Error('Immediate Error');
|
|
});
|
|
});
|
|
|
|
timeout = setTimeout(function() {}, 10 * 1000);
|
|
|
|
process.on('exit', function() {
|
|
assert.equal(timeout_err.message, 'Timeout UNREFd',
|
|
'Domain should catch timer error');
|
|
assert.equal(immediate_err.message, 'Immediate Error',
|
|
'Domain should catch immediate error');
|
|
});
|