0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-process-exception-capture.js

14 lines
473 B
JavaScript
Raw Normal View History

// Flags: --abort-on-uncaught-exception
'use strict';
const common = require('../common');
const assert = require('assert');
assert.strictEqual(process.hasUncaughtExceptionCaptureCallback(), false);
// This should make the process not crash even though the flag was passed.
process.setUncaughtExceptionCaptureCallback(common.mustCall((err) => {
assert.strictEqual(err.message, 'foo');
}));
process.on('uncaughtException', common.mustNotCall());
throw new Error('foo');