summaryrefslogtreecommitdiff
path: root/test/node-api/test_async/test-uncaught.js
blob: fdcb3203f544107848ee5c14f05cb4788fc61e85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
'use strict';
const common = require('../../common');
const assert = require('assert');
const test_async = require(`./build/${common.buildType}/test_async`);

process.on('uncaughtException', common.mustCall(function(err) {
  try {
    throw new Error('should not fail');
  } catch (err) {
    assert.strictEqual(err.message, 'should not fail');
  }
  assert.strictEqual(err.message, 'uncaught');
}));

// Successful async execution and completion callback.
test_async.Test(5, {}, common.mustCall(function() {
  throw new Error('uncaught');
}));