1'use strict'; 2const common = require('../common'); 3const assert = require('assert'); 4const EventEmitter = require('events'); 5 6// Tests that the error stack where the exception was thrown is *not* appended. 7 8process.on('uncaughtException', common.mustCall((err) => { 9 const lines = err.stack.split('\n'); 10 assert.strictEqual(lines[0], 'Error'); 11 lines.slice(1).forEach((line) => { 12 assert(/^ at/.test(line), `${line} has an unexpected format`); 13 }); 14})); 15 16new EventEmitter().emit('error', new Error()); 17