2020-12-14 19:10:51 +08:00
|
|
|
'use strict';
|
|
|
|
|
// Flags: --expose-gc --force-node-api-uncaught-exceptions-policy
|
|
|
|
|
|
|
|
|
|
const common = require('../../common');
|
2023-09-25 12:23:58 +08:00
|
|
|
const binding = require(`./build/${common.buildType}/test_finalizer`);
|
2020-12-14 19:10:51 +08:00
|
|
|
const assert = require('assert');
|
|
|
|
|
|
|
|
|
|
process.on('uncaughtException', common.mustCall((err) => {
|
|
|
|
|
assert.throws(() => { throw err; }, /finalizer error/);
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
(async function() {
|
|
|
|
|
{
|
2023-09-25 12:23:58 +08:00
|
|
|
binding.createExternalWithJsFinalize(
|
2020-12-14 19:10:51 +08:00
|
|
|
common.mustCall(() => {
|
|
|
|
|
throw new Error('finalizer error');
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
global.gc();
|
|
|
|
|
})().then(common.mustCall());
|