Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
n-api: test uncaught exception in worker
  • Loading branch information
mafintosh committed Mar 14, 2018
commit 7fefdda4b21ad035719f1e378b0018be9795b481
18 changes: 18 additions & 0 deletions test/addons-napi/test_async/test-uncaught.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,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');
}));