Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f4698f3

Browse filesBrowse files
Trottevanlucas
authored andcommitted
test: add uncaught exception test for debugger
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>
1 parent bfd8265 commit f4698f3
Copy full SHA for f4698f3

File tree

Expand file treeCollapse file tree

2 files changed

+33
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+33
-0
lines changed
Open diff view settings
Collapse file

‎test/fixtures/debug-uncaught.js‎

Copy file name to clipboard
+16Lines changed: 16 additions & 0 deletions
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();
Collapse file
+17Lines changed: 17 additions & 0 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.