2017-06-09 21:27:02 +02:00
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const async_hooks = require('async_hooks');
|
2025-01-22 14:19:38 -08:00
|
|
|
const { isMainThread } = require('worker_threads');
|
2017-06-09 21:27:02 +02:00
|
|
|
|
2025-01-22 14:19:38 -08:00
|
|
|
if (!isMainThread) {
|
2018-05-18 01:20:25 +02:00
|
|
|
common.skip('Worker bootstrapping works differently -> different AsyncWraps');
|
2025-01-22 14:19:38 -08:00
|
|
|
}
|
2018-05-18 01:20:25 +02:00
|
|
|
|
2017-06-09 21:27:02 +02:00
|
|
|
const hook = async_hooks.createHook({
|
|
|
|
init: common.mustCall(2),
|
|
|
|
before: common.mustCall(1),
|
|
|
|
after: common.mustNotCall()
|
|
|
|
}).enable();
|
|
|
|
|
|
|
|
Promise.resolve(1).then(common.mustCall(() => {
|
|
|
|
hook.disable();
|
|
|
|
|
|
|
|
Promise.resolve(42).then(common.mustCall());
|
|
|
|
|
|
|
|
process.nextTick(common.mustCall());
|
|
|
|
}));
|