2

I'm trying to debug my Mocha test in IntelliJ 13.1.4 so I put breakpoints in my test/test.js file.

In my Node.js Run/Debug Configurations, I've correctly set the Node interpreter and the Working directory points to my project root.

The JavaScript file to execute is set to ./node_modules/.bin/mocha.

If I click on the "Debug" button, my test is executed, but my breakpoints are ignored.

Does someone know why?

Anthony O.
  • 22,041
  • 18
  • 107
  • 163

1 Answers1

1

Actually, it seems to be more a Mocha problem.

Here is what I did thanks to that other similar SO answer: adding --debug-brk to the Application parameters in the Run/Debug Configuration.

Community
  • 1
  • 1
Anthony O.
  • 22,041
  • 18
  • 107
  • 163
  • Interesting... Intellij adds that as part of the launch (in version 15 at least), but it assigns a port to it. I added this as a parameter to the run configuration (without a port), and it worked. Check it out: /.nvm/versions/node/v4.4.5/bin/node --debug-brk=50449 --nolazy node_modules/mocha/bin/mocha automation/wdio/**/*.test.js --reporter spec --debug-brk. Adding the extra --debug-brk to the application parameters worked. – binarygiant Oct 05 '16 at 16:17
  • now it's probably --inspect-brk – Manjabes Oct 04 '22 at 11:52