Skip to content
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

Fix debugging with Webstorm on Node.js 8 #1414

Merged
merged 4 commits into from
Jun 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ class Api extends EventEmitter {
const execArgv = this.options.testOnlyExecArgv || process.execArgv;
let debugArgIndex = -1;

// --debug-brk is used in addition to --inspect to break on first line and wait
// --inspect-brk is used in addition to --inspect to break on first line and wait
execArgv.some((arg, index) => {
const isDebugArg = arg === '--inspect' || arg.indexOf('--inspect=') === 0;
const isDebugArg = /^--inspect(-brk)?($|=)/.test(arg);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no --inspect-brk. Could you update t=your regex removing that validation, please?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (isDebugArg) {
debugArgIndex = index;
}
Expand All @@ -184,7 +184,7 @@ class Api extends EventEmitter {
const isInspect = debugArgIndex >= 0;
if (!isInspect) {
execArgv.some((arg, index) => {
const isDebugArg = arg === '--debug' || arg === '--debug-brk' || arg.indexOf('--debug-brk=') === 0 || arg.indexOf('--debug=') === 0;
const isDebugArg = /^--debug(-brk)?($|=)/.test(arg);
if (isDebugArg) {
debugArgIndex = index;
}
Expand Down
2 changes: 2 additions & 0 deletions test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1049,9 +1049,11 @@ generatePassDebugTests(['--debug'], -1);
generatePassDebugTests(['--inspect=0'], 0);
generatePassDebugTests(['--inspect'], 0);

// --inspect takes precedence
generatePassDebugTests(['--inspect=0', '--debug-brk'], 0);
generatePassDebugTests(['--inspect', '--debug-brk'], 0);

// --inspect takes precedence, though --debug-brk is still passed to the worker
generatePassDebugTests(['--debug-brk', '--inspect=0'], 1);
generatePassDebugTests(['--debug-brk', '--inspect'], 1);

Expand Down