mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
678551c294
If the exception is handled by the userland process#uncaughtException handler, reports should not be generated repetitively as the process may continue to run. PR-URL: https://github.com/nodejs/node/pull/44208 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
33 lines
858 B
JavaScript
33 lines
858 B
JavaScript
'use strict';
|
|
// Test producing a report on uncaught exception.
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const childProcess = require('child_process');
|
|
const helper = require('../common/report');
|
|
const tmpdir = require('../common/tmpdir');
|
|
|
|
if (process.argv[2] === 'child') {
|
|
// eslint-disable-next-line no-throw-literal
|
|
throw 1;
|
|
}
|
|
|
|
tmpdir.refresh();
|
|
const child = childProcess.spawn(process.execPath, [
|
|
'--report-uncaught-exception',
|
|
__filename,
|
|
'child',
|
|
], {
|
|
cwd: tmpdir.path,
|
|
});
|
|
child.on('exit', common.mustCall((code) => {
|
|
assert.strictEqual(code, 1);
|
|
const reports = helper.findReports(child.pid, tmpdir.path);
|
|
assert.strictEqual(reports.length, 1);
|
|
|
|
helper.validate(reports[0], [
|
|
['header.event', 'Exception'],
|
|
['header.trigger', 'Exception'],
|
|
['javascriptStack.message', '1'],
|
|
]);
|
|
}));
|