diff --git a/test/fixtures/debug-uncaught.js b/test/fixtures/debug-uncaught.js new file mode 100644 index 00000000000000..f09d62f3580f32 --- /dev/null +++ b/test/fixtures/debug-uncaught.js @@ -0,0 +1,16 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); +const debug = require('_debugger'); + +function emit() { + const error = new Error('sterrance'); + process.emit('uncaughtException', error); +} + +assert.doesNotThrow(emit); + +debug.start(['fhqwhgads']); + +emit(); diff --git a/test/parallel/test-debug-uncaught-exception.js b/test/parallel/test-debug-uncaught-exception.js new file mode 100644 index 00000000000000..64c98469942dab --- /dev/null +++ b/test/parallel/test-debug-uncaught-exception.js @@ -0,0 +1,17 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const path = require('path'); +const spawnSync = require('child_process').spawnSync; + +const emitUncaught = path.join(common.fixturesDir, 'debug-uncaught.js'); +const result = spawnSync(process.execPath, [emitUncaught], {encoding: 'utf8'}); + +const expectedMessage = + "There was an internal error in Node's debugger. Please report this bug."; + +assert.strictEqual(result.status, 1); +assert(result.stderr.includes(expectedMessage)); +assert(result.stderr.includes('Error: sterrance')); + +console.log(result.stdout);