mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
Add support for the following methods; napi_open_callback_scope napi_close_callback_scope These are needed when running asynchronous methods directly using uv. PR-URL: https://github.com/nodejs/node/pull/18089 Fixes: https://github.com/nodejs/node/issues/15604 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
18 lines
426 B
JavaScript
18 lines
426 B
JavaScript
'use strict';
|
|
|
|
const common = require('../../common');
|
|
const assert = require('assert');
|
|
const { runInCallbackScope } = require(`./build/${common.buildType}/binding`);
|
|
|
|
assert.strictEqual(runInCallbackScope({}, 0, 0, () => 42), 42);
|
|
|
|
{
|
|
process.once('uncaughtException', common.mustCall((err) => {
|
|
assert.strictEqual(err.message, 'foo');
|
|
}));
|
|
|
|
runInCallbackScope({}, 0, 0, () => {
|
|
throw new Error('foo');
|
|
});
|
|
}
|