Skip to content

Commit

Permalink
ensure --debug becomes --inspect; closes #3697
Browse files Browse the repository at this point in the history
- add some handiness to the integration test helpers
- update docstrings in integration test helpers
  • Loading branch information
boneskull committed Jan 29, 2019
1 parent c91b325 commit 5e9f23c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions bin/mocha
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,28 @@ Object.keys(opts).forEach(opt => {
}
});

// allow --debug to invoke --inspect on Node.js v8 or newer
if (childOpts.debug) {
nodeOpts.inspect = childOpts.debug;
childOpts.timeout = false;
delete childOpts.debug;
debug('--debug -> --inspect');
} else if (childOpts['debug-brk']) {
nodeOpts['inspect-brk'] = childOpts['debug-brk'];
childOpts.timeout = false;
delete childOpts['debug-brk'];
debug('--debug-brk -> --inspect-brk');
}

// historical
if (nodeOpts.gc) {
deprecate(
'"-gc" is deprecated and will be removed from a future version of Mocha. Use "--gc-global" instead.'
);
nodeOpts['gc-global'] = nodeOpts.gc;
delete nodeOpts.gc;
}

// Native debugger handling
// see https://nodejs.org/api/debugger.html#debugger_debugger
// look for 'debug' or 'inspect' that would launch this debugger,
Expand Down

0 comments on commit 5e9f23c

Please sign in to comment.