2017-12-13 08:37:40 +08:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const common = require('../../common');
|
|
|
|
const assert = require('assert');
|
|
|
|
const { runInCallbackScope } = require(`./build/${common.buildType}/binding`);
|
|
|
|
|
2020-04-19 17:45:02 +08:00
|
|
|
assert.strictEqual(runInCallbackScope({}, 'test-resource', () => 42), 42);
|
2017-12-13 08:37:40 +08:00
|
|
|
|
|
|
|
{
|
|
|
|
process.once('uncaughtException', common.mustCall((err) => {
|
|
|
|
assert.strictEqual(err.message, 'foo');
|
|
|
|
}));
|
|
|
|
|
2020-04-19 17:45:02 +08:00
|
|
|
runInCallbackScope({}, 'test-resource', () => {
|
2017-12-13 08:37:40 +08:00
|
|
|
throw new Error('foo');
|
|
|
|
});
|
|
|
|
}
|