1'use strict'; 2// Flags: --expose-gc 3 4const common = require('../../common'); 5const assert = require('assert'); 6const test_exception = require(`./build/${common.buildType}/test_exception`); 7 8// Make sure that exceptions that occur during finalization are propagated. 9function testFinalize(binding) { 10 let x = test_exception[binding](); 11 x = null; 12 global.gc(); 13 process.on('uncaughtException', (err) => { 14 assert.strictEqual(err.message, 'Error during Finalize'); 15 }); 16 17 // To assuage the linter's concerns. 18 (function() {})(x); 19} 20testFinalize('createExternalBuffer'); 21