You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

27 lines
744 B

'use strict';
// Regression test for https://github.com/nodejs/node/issues/13262
const common = require('../common');
const assert = require('assert');
const async_hooks = require('async_hooks');
let seenId, seenResource;
async_hooks.createHook({
init: common.mustCall((id, provider, triggerAsyncId, resource) => {
seenId = id;
seenResource = resource;
assert.strictEqual(provider, 'Immediate');
assert.strictEqual(triggerAsyncId, 1);
}),
before: common.mustNotCall(),
after: common.mustNotCall(),
destroy: common.mustCall((id) => {
assert.strictEqual(seenId, id);
})
}).enable();
const immediate = setImmediate(common.mustNotCall());
assert.strictEqual(immediate, seenResource);
clearImmediate(immediate);