Skip to content

Commit

Permalink
test: add uncaught exception test for debugger
Browse files Browse the repository at this point in the history
PR-URL: #8087
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and Myles Borins committed Sep 17, 2016
1 parent ee54dc6 commit 5b79c90
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
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.";

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

console.log(result.stdout);

0 comments on commit 5b79c90

Please sign in to comment.