11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci// Flags: --expose-gc --force-node-api-uncaught-exceptions-policy 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ciconst common = require('../../common'); 51cb0ef41Sopenharmony_ciconst binding = require(`./build/${common.buildType}/test_finalizer`); 61cb0ef41Sopenharmony_ciconst assert = require('assert'); 71cb0ef41Sopenharmony_ciconst tick = require('util').promisify(require('../../common/tick')); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciprocess.on('uncaughtException', common.mustCall((err) => { 101cb0ef41Sopenharmony_ci assert.throws(() => { throw err; }, /finalizer error/); 111cb0ef41Sopenharmony_ci})); 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ci(async function() { 141cb0ef41Sopenharmony_ci { 151cb0ef41Sopenharmony_ci binding.malignFinalizerBuffer(common.mustCall(() => { 161cb0ef41Sopenharmony_ci throw new Error('finalizer error'); 171cb0ef41Sopenharmony_ci })); 181cb0ef41Sopenharmony_ci } 191cb0ef41Sopenharmony_ci global.gc({ type: 'minor' }); 201cb0ef41Sopenharmony_ci await tick(common.platformTimeout(100)); 211cb0ef41Sopenharmony_ci global.gc(); 221cb0ef41Sopenharmony_ci await tick(common.platformTimeout(100)); 231cb0ef41Sopenharmony_ci global.gc(); 241cb0ef41Sopenharmony_ci await tick(common.platformTimeout(100)); 251cb0ef41Sopenharmony_ci})().then(common.mustCall()); 26