1'use strict';
2// Flags: --expose-gc --force-node-api-uncaught-exceptions-policy
3
4const common = require('../../common');
5const binding = require(`./build/${common.buildType}/test_finalizer`);
6const assert = require('assert');
7
8process.on('uncaughtException', common.mustCall((err) => {
9  assert.throws(() => { throw err; }, /finalizer error/);
10}));
11
12(async function() {
13  {
14    binding.createExternalWithJsFinalize(
15      common.mustCall(() => {
16        throw new Error('finalizer error');
17      }));
18  }
19  global.gc();
20})().then(common.mustCall());
21