summaryrefslogtreecommitdiff
path: root/test/node-api/test_exception/test.js
blob: 1373d8c06fb7478b2e2d449ba139b8967a165153 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
'use strict';
// Flags: --expose-gc

const common = require('../../common');
const assert = require('assert');
const test_exception = require(`./build/${common.buildType}/test_exception`);

// Make sure that exceptions that occur during finalization are propagated.
function testFinalize(binding) {
  let x = test_exception[binding]();
  x = null;
  global.gc();
  process.on('uncaughtException', (err) => {
    assert.strictEqual(err.message, 'Error during Finalize');
  });

  // To assuage the linter's concerns.
  (function() {})(x);
}
testFinalize('createExternalBuffer');