forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add uncaught exception test for debugger
PR-URL: nodejs#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]>
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |