From ea54545188a5ea7a0f6e4a60fdfde9f24c6586e4 Mon Sep 17 00:00:00 2001 From: Dominic Garms Date: Wed, 14 Jun 2017 22:33:18 +0800 Subject: [PATCH 1/4] Update api.js add `--inspect-brk` for Webstorm debugging --- api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api.js b/api.js index e5c5a7b92..c3a64ca53 100644 --- a/api.js +++ b/api.js @@ -173,7 +173,7 @@ class Api extends EventEmitter { // --debug-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 = arg === '--inspect' || arg === '--inspect-brk' || arg.indexOf('--inspect=') === 0 || arg.indexOf('--inspect-brk=') === 0; if (isDebugArg) { debugArgIndex = index; } From fc9c924811e035ba8ef7daad6d2c78eb98e73e95 Mon Sep 17 00:00:00 2001 From: Mark Wubben Date: Sat, 17 Jun 2017 16:25:07 +0100 Subject: [PATCH 2/4] Rename confusing --debug-brk in code comment --- api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api.js b/api.js index c3a64ca53..745dd7a23 100644 --- a/api.js +++ b/api.js @@ -171,7 +171,7 @@ 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 === '--inspect-brk' || arg.indexOf('--inspect=') === 0 || arg.indexOf('--inspect-brk=') === 0; if (isDebugArg) { From 6715f2fae45bdd4f0478118014f5d75baa1662b4 Mon Sep 17 00:00:00 2001 From: Mark Wubben Date: Sat, 17 Jun 2017 16:29:05 +0100 Subject: [PATCH 3/4] Document curious test behavior around --inspect and --debug flags --- test/api.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/api.js b/test/api.js index 871975874..37a6cec96 100644 --- a/test/api.js +++ b/test/api.js @@ -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); From c9d03c1913a83913933fd4a0d557060ee9473c94 Mon Sep 17 00:00:00 2001 From: Mark Wubben Date: Sat, 17 Jun 2017 16:35:25 +0100 Subject: [PATCH 4/4] Match --debug and --inspect args with regular expressions --- api.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api.js b/api.js index 745dd7a23..0179affbb 100644 --- a/api.js +++ b/api.js @@ -173,7 +173,7 @@ class Api extends EventEmitter { // --inspect-brk is used in addition to --inspect to break on first line and wait execArgv.some((arg, index) => { - const isDebugArg = arg === '--inspect' || arg === '--inspect-brk' || arg.indexOf('--inspect=') === 0 || arg.indexOf('--inspect-brk=') === 0; + const isDebugArg = /^--inspect(-brk)?($|=)/.test(arg); if (isDebugArg) { debugArgIndex = index; } @@ -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; }