0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-24 20:29:23 +01:00
nodejs/test/parallel/test-events-uncaught-exception-stack.js
Rich Trott dcc368f4be tools,lib,test: enable ESLint no-regex-spaces rule
PR-URL: https://github.com/nodejs/node/pull/41463
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
2022-01-13 17:12:05 -08:00

17 lines
477 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const EventEmitter = require('events');
// Tests that the error stack where the exception was thrown is *not* appended.
process.on('uncaughtException', common.mustCall((err) => {
const lines = err.stack.split('\n');
assert.strictEqual(lines[0], 'Error');
lines.slice(1).forEach((line) => {
assert.match(line, /^ {4}at/);
});
}));
new EventEmitter().emit('error', new Error());