Upload Kmake

This commit is contained in:
Gorochu
2026-05-26 23:36:42 -07:00
parent ba051b2f74
commit 555ec72358
41615 changed files with 13344630 additions and 1 deletions

View File

@ -0,0 +1,39 @@
'use strict';
const common = require('../../common');
const assert = require('assert');
const async_hooks = require('async_hooks');
// The async_hook that we enable would register the process.emitWarning()
// call from loading the N-API addon as asynchronous activity because
// it contains a process.nextTick() call. Monkey patch it to be a no-op
// before we load the addon in order to avoid this.
process.emitWarning = () => {};
const { runInCallbackScope } = require(`./build/${common.buildType}/binding`);
const expectedResource = {};
const expectedResourceType = 'test-resource';
let insideHook = false;
let expectedId;
async_hooks.createHook({
init: common.mustCall((id, type, triggerAsyncId, resource) => {
if (type !== expectedResourceType) {
return;
}
assert.strictEqual(resource, expectedResource);
expectedId = id;
}),
before: common.mustCall((id) => {
assert.strictEqual(id, expectedId);
insideHook = true;
}),
after: common.mustCall((id) => {
assert.strictEqual(id, expectedId);
insideHook = false;
}),
}).enable();
runInCallbackScope(expectedResource, expectedResourceType, () => {
assert(insideHook);
});