mirror of
https://github.com/nodejs/node.git
synced 2025-04-28 21:46:48 +00:00

This enables the option `--force-node-api-uncaught-exceptions-policy` for a specific Node-API addon when it is compiled with `NAPI_EXPERIMENTAL` (and this would be the default behavior when `NAPI_VERSION` 10 releases). This would not break existing Node-API addons. PR-URL: https://github.com/nodejs/node/pull/49313 Refs: https://github.com/nodejs/node/pull/36510 Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Gabriel Schulhof <gabrielschulhof@gmail.com>
26 lines
778 B
JavaScript
26 lines
778 B
JavaScript
'use strict';
|
|
// Flags: --expose-gc --force-node-api-uncaught-exceptions-policy
|
|
|
|
const common = require('../../common');
|
|
const binding = require(`./build/${common.buildType}/test_finalizer`);
|
|
const assert = require('assert');
|
|
const tick = require('util').promisify(require('../../common/tick'));
|
|
|
|
process.on('uncaughtException', common.mustCall((err) => {
|
|
assert.throws(() => { throw err; }, /finalizer error/);
|
|
}));
|
|
|
|
(async function() {
|
|
{
|
|
binding.malignFinalizerBuffer(common.mustCall(() => {
|
|
throw new Error('finalizer error');
|
|
}));
|
|
}
|
|
global.gc({ type: 'minor' });
|
|
await tick(common.platformTimeout(100));
|
|
global.gc();
|
|
await tick(common.platformTimeout(100));
|
|
global.gc();
|
|
await tick(common.platformTimeout(100));
|
|
})().then(common.mustCall());
|