mirror of
https://github.com/nodejs/node.git
synced 2024-11-30 15:30:56 +01:00
bd462ad81b
Only activated on some subfolders to minimize the diff, ideally this rule would be applied gradually to the entire codebase in follow-up commits. PR-URL: https://github.com/nodejs/node/pull/45468 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
33 lines
871 B
JavaScript
33 lines
871 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') {
|
|
throw new Error('test error');
|
|
}
|
|
|
|
tmpdir.refresh();
|
|
const child = childProcess.spawn(process.execPath, [
|
|
'--report-uncaught-exception',
|
|
'--report-compact',
|
|
__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', 'Error: test error'],
|
|
]);
|
|
}));
|