1'use strict'; 2 3const common = require('../common'); 4const assert = require('assert'); 5 6// We don't really care about the calling results here. 7// So, this makes the test less fragile. 8const noop = () => {}; 9 10const t1 = setTimeout(common.mustNotCall(), 1); 11const t2 = setTimeout(common.mustCall(), 1); 12const i1 = setInterval(common.mustNotCall(), 1); 13const i2 = setInterval(noop, 1); 14i2.unref(); 15 16// Keep process alive for i2 to call once due to timer ordering. 17setTimeout(common.mustCall(), 1); 18 19clearTimeout(t1); 20clearInterval(i1); 21 22process.on('exit', () => { 23 assert.strictEqual(t1._destroyed, true); 24 assert.strictEqual(t2._destroyed, true); 25 assert.strictEqual(i1._destroyed, true); 26 assert.strictEqual(i2._destroyed, false); 27}); 28