Files
bun.sh/test/js/node/test/parallel/test-process-exception-capture.js
2024-12-09 19:08:30 -08:00

15 lines
560 B
JavaScript

// Flags: --abort-on-uncaught-exception
'use strict';
const common = require('../common');
if (common.isWindows) return; // TODO: BUN https://github.com/oven-sh/bun/issues/12827
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');