mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
f29762f4dd
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>
27 lines
529 B
JavaScript
27 lines
529 B
JavaScript
'use strict';
|
|
var assert = require('assert');
|
|
|
|
var called = 0;
|
|
var closed = 0;
|
|
|
|
var timeout = setTimeout(function() {
|
|
called++;
|
|
}, 10);
|
|
timeout.unref();
|
|
|
|
// Wrap `close` method to check if the handle was closed
|
|
var close = timeout._handle.close;
|
|
timeout._handle.close = function() {
|
|
closed++;
|
|
return close.apply(this, arguments);
|
|
};
|
|
|
|
// Just to keep process alive and let previous timer's handle die
|
|
setTimeout(function() {
|
|
}, 50);
|
|
|
|
process.on('exit', function() {
|
|
assert.equal(called, 1);
|
|
assert.equal(closed, 1);
|
|
});
|