mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 15:32:15 +00:00

common.js contains code that checks for variables leaking into the global namespace. Load common.js in all tests that do not intentionally leak variables. PR-URL: https://github.com/nodejs/node/pull/3095 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
28 lines
551 B
JavaScript
28 lines
551 B
JavaScript
'use strict';
|
|
require('../common');
|
|
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);
|
|
});
|