-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: increase _debugger coverage #8403
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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('fhqwhgads'); | ||
process.emit('uncaughtException', error); | ||
} | ||
|
||
assert.doesNotThrow(emit); | ||
|
||
debug.start(['sterrance']); | ||
|
||
setImmediate(emit); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const path = require('path'); | ||
const spawn = require('child_process').spawn; | ||
|
||
const emitUncaught = path.join(common.fixturesDir, 'debug-uncaught-async.js'); | ||
const result = spawn(process.execPath, [emitUncaught], {encoding: 'utf8'}); | ||
|
||
var stderr = ''; | ||
result.stderr.on('data', (data) => { | ||
stderr += data; | ||
}); | ||
|
||
result.on('close', (code) => { | ||
const expectedMessage = | ||
"There was an internal error in Node's debugger. Please report this bug."; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Single quotes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used double-quotes to avoid escaping the apostrophe in |
||
|
||
assert.strictEqual(code, 1); | ||
assert(stderr.includes(expectedMessage)); | ||
assert(stderr.includes('Error: fhqwhgads')); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wut?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's sending
debug.start()
anargv
array of length 1 to avoid code that exits ifargv
is empty.I'll add a comment and/or change
sterrance
to a more meaningful string.