1'use strict'; 2 3const common = require('../../common'); 4const assert = require('assert'); 5const async_hooks = require('async_hooks'); 6const { runInCallbackScope } = require(`./build/${common.buildType}/binding`); 7 8let insideHook = false; 9async_hooks.createHook({ 10 before: common.mustCall((id) => { 11 assert.strictEqual(id, 1000); 12 insideHook = true; 13 }), 14 after: common.mustCall((id) => { 15 assert.strictEqual(id, 1000); 16 insideHook = false; 17 }), 18}).enable(); 19 20runInCallbackScope({}, 1000, 1000, () => { 21 assert(insideHook); 22}); 23