Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions test/fixtures/debug-uncaught.js
Original file line number Diff line number Diff line change
@@ -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();
17 changes: 17 additions & 0 deletions test/parallel/test-debug-uncaught-exception.js
Original file line number Diff line number Diff line change
@@ -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.";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiniest of nits: line continuations should have four spaces of indent.


assert.strictEqual(result.status, 1);
assert(result.stderr.includes(expectedMessage));
assert(result.stderr.includes('Error: sterrance'));

console.log(result.stdout);