mocha --inspect-brk --inspect seems to not be supported now

Created on 26 Feb 2019  路  11Comments  路  Source: mochajs/mocha

Prerequisites

  • [x] Checked that your issue hasn't already been filed by cross-referencing issues with the faq label
  • [x] Checked next-gen ES issues and syntax problems by using the same environment and/or transpiler configuration without Mocha to ensure it isn't just a feature that actually isn't supported in the environment in question or a bug in your code.
  • [x] 'Smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, your usage of Mocha, or Mocha itself
  • [x] Ensured that there is no discrepancy between the locally and globally installed versions of Mocha. You can find them with: node node_modules/.bin/mocha --version(Local) and mocha --version(Global). We recommend that you _not_ install Mocha globally.

Description

$ ./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

Versions

  • The output of node node_modules/.bin/mocha --version: 6.0.2
  • The output of node --version: v10.15.0
  • Your operating system

    • name and version: macOS-10.14.2

    • architecture: 64-bit

confirmed-bug help wanted

All 11 comments

Little more information, please...

  • macOS what version
  • (used to work) - what version was that?

--inspect-brk triggers 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.

To fix this, remove inspect from arguments if inspect-brk is present. Likewise with debug/debug-brk. You'd probably want to do that here.

Add a test that ensures it works as intended here.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Aarbel picture Aarbel  路  3Comments

3p3r picture 3p3r  路  3Comments

jamietre picture jamietre  路  3Comments

danielserrao picture danielserrao  路  3Comments

enigmatic00 picture enigmatic00  路  3Comments