mirror of https://github.com/lukechilds/node.git
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.
23 lines
542 B
23 lines
542 B
8 years ago
|
'use strict';
|
||
|
|
||
|
const common = require('../../common');
|
||
|
const assert = require('assert');
|
||
|
const async_hooks = require('async_hooks');
|
||
|
const { runInCallbackScope } = require(`./build/${common.buildType}/binding`);
|
||
|
|
||
|
let insideHook = false;
|
||
|
async_hooks.createHook({
|
||
|
before: common.mustCall((id) => {
|
||
|
assert.strictEqual(id, 1000);
|
||
|
insideHook = true;
|
||
|
}),
|
||
|
after: common.mustCall((id) => {
|
||
|
assert.strictEqual(id, 1000);
|
||
|
insideHook = false;
|
||
|
})
|
||
|
}).enable();
|
||
|
|
||
|
runInCallbackScope({}, 1000, 1000, () => {
|
||
|
assert(insideHook);
|
||
|
});
|