-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
inspector: fix crash on exception #13455
Conversation
test/inspector/test-inspector.js
Outdated
return function(result) { | ||
const expected = helper.mainScriptSource(mainScript); | ||
const source = result['scriptSource']; | ||
assert(source && (source.includes(expected)), |
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.
The “middle” parentheses are unnecessary here
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.
Wanted to do this myself 😃
test/inspector/inspector-helper.js
Outdated
const args = [].concat(inspectorFlags); | ||
if (opt_script_contents) { | ||
if (!mainScript.endsWith('.js')) { |
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.
Do you have a guarantee that typeof mainScript.endsWith === 'function'
?
Maybe try !String.prototype.endsWith(mainScript, '.js')
Also flip if/else and remove !
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.
This is an undocumented internal function. I think it's safe to assume that whoever wants to add a new test will look at the code to figure out how it works (just like I did).
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.
Ack.
But I'm still +1(non-blocking) on inverting
I would like to see a regression test in var child = spawn(process.argv[0], ['inspect', `${common.fixturesDir}/throws_error2.js`])
child.stdin.write('c\n'); that should cause is to explode (before this fix) |
Two approvals, so it's CI time: https://ci.nodejs.org/job/node-test-commit/10357/ |
Regression is in
|
Fixed the regression and flipped the if/else. Adding a test for the "inspect" command seems redundant (and less direct). |
👍
🤷♂️ |
Quick CI (linuxone): https://ci.nodejs.org/job/node-test-commit-linuxone/6390/ |
Rebased on master, reworked the test a bit. PTAL again. |
Fixes #13438.
cc @eugeneo
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
inspector