MCPcopy Create free account
hub / github.com/nodejs/node-addon-api / makeCallbackWithoutResource

Function makeCallbackWithoutResource

test/async_context.js:88–108  ·  view source on GitHub ↗
(binding)

Source from the content-addressed store, hash-verified

86}
87
88async function makeCallbackWithoutResource (binding) {
89 const hooks = installAsyncHooksForTest('async_context_no_res_test');
90 const triggerAsyncId = asyncHooks.executionAsyncId();
91 await new Promise((resolve, reject) => {
92 binding.asynccontext.makeCallbackNoResource(common.mustCall());
93 hooks.then(actual => {
94 assert.deepStrictEqual(actual, [
95 {
96 eventName: 'init',
97 type: 'async_context_no_res_test',
98 triggerAsyncId,
99 resource: { }
100 },
101 { eventName: 'before' },
102 { eventName: 'after' },
103 { eventName: 'destroy' }
104 ]);
105 }).catch(common.mustNotCall());
106 resolve();
107 });
108}
109
110function assertAsyncContextReturnsCorrectEnv (binding) {
111 assert.strictEqual(binding.asynccontext.asyncCxtReturnCorrectEnv(), true);

Callers 1

testFunction · 0.85

Calls 1

installAsyncHooksForTestFunction · 0.70

Tested by 1

testFunction · 0.68