faq labelnode node_modules/.bin/mocha --version(Local) and mocha --version(Global). We recommend that you _not_ install Mocha globally.$ ./node_modules/.bin/mocha --inspect-brk --inspect --opts mocha.opts
Expected behavior: Should work as expected with debug mode on (used to work in mocha 5.x.x)
Actual behavior: but now get error:
$ mocha --inspect-brk --inspect --opts mocha.opts
/usr/local/bin/node: bad option: --inspect-brk --inspect
Workaround
The following seems to work. Not sure if there is a fundamental difference with the above command.
$ node --inspect-brk --inspect ./node_modules/.bin/mocha --opts mocha.opts
node node_modules/.bin/mocha --version: 6.0.2node --version: v10.15.0Little more information, please...
--inspect-brktriggers the same codepath as--inspect --debug-brk.
Neither here nor there, but why repeat the same cmdline argument?
@plroebuck updated the OSX version and the "used to work" mocha version (5.x.x) not sure which one I had, but was in the 5.x range.
yes, tried with --debug-brk as well, and does not work. When I put the --inspect-brk --inspect before the ...mocha commands as node arguments, it works.
I know at least two issues dealing with that argument were closed recently, but someone else's work. Did have something to do with allowing --inspect to have an argument though. As such, might want to try shuffling the order of the arguments.
Try this and see if it shows anything of note:
$ DEBUG=mocha:cli:* mocha --opts mocha.opts --inspect-brk
@jeremychone --inspect and --inspect-brk is redundant. just use --inspect-brk
I'll call this a bug since it deviates from Node's behavior, which is to ignore --inspect when --inspect-brk is present.
I can look at this.
@craigtaub
The bug has a different cause. Mocha did not accept more than one Node flag, see #3787 .
Node should be able to handle --inspect plus --inspect-brk anyway.
I'm sorry that I haven't seen your PR earlier.
@juergba i didnt see that, your right this bug is now fixed on master.
Thank you all.