Skip to content

Commit 733233d

Browse files
TrottMylesBorins
authored andcommitted
test: add uncaught exception test for debugger
PR-URL: #8087 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: targos - Michaël Zasso <[email protected]> Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]> Reviewed-By: cjihrig - Colin Ihrig <[email protected]> Reviewed-By: jasnell - James M Snell <[email protected]>
1 parent c9af24d commit 733233d

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

test/fixtures/debug-uncaught.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use strict';
2+
3+
require('../common');
4+
const assert = require('assert');
5+
const debug = require('_debugger');
6+
7+
function emit() {
8+
const error = new Error('sterrance');
9+
process.emit('uncaughtException', error);
10+
}
11+
12+
assert.doesNotThrow(emit);
13+
14+
debug.start(['fhqwhgads']);
15+
16+
emit();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use strict';
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const path = require('path');
5+
const spawnSync = require('child_process').spawnSync;
6+
7+
const emitUncaught = path.join(common.fixturesDir, 'debug-uncaught.js');
8+
const result = spawnSync(process.execPath, [emitUncaught], {encoding: 'utf8'});
9+
10+
const expectedMessage =
11+
"There was an internal error in Node's debugger. Please report this bug.";
12+
13+
assert.strictEqual(result.status, 1);
14+
assert(result.stderr.includes(expectedMessage));
15+
assert(result.stderr.includes('Error: sterrance'));
16+
17+
console.log(result.stdout);

0 commit comments

Comments
 (0)