mirror of https://github.com/nodejs/node.git
26 lines
691 B
JavaScript
26 lines
691 B
JavaScript
// Flags: --report-uncaught-exception
|
|
'use strict';
|
|
// Test producing a report on uncaught exception.
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const helper = require('../common/report');
|
|
const tmpdir = require('../common/tmpdir');
|
|
|
|
const exception = 1;
|
|
|
|
tmpdir.refresh();
|
|
process.report.directory = tmpdir.path;
|
|
|
|
process.on('uncaughtException', common.mustCall((err) => {
|
|
assert.strictEqual(err, exception);
|
|
const reports = helper.findReports(process.pid, tmpdir.path);
|
|
assert.strictEqual(reports.length, 1);
|
|
|
|
helper.validate(reports[0], [
|
|
['header.event', 'Exception'],
|
|
['javascriptStack.message', `${exception}`],
|
|
]);
|
|
}));
|
|
|
|
throw exception;
|