I am using mocha to test my code. I am using node inspector to debug my code.
bash
mocha test/test.* --debug-brk
This works but not so well. It stops at the first line of code in mocha. I want it to stop it at my code. I tried using the 'debugger' key word to make a manual breakpoint but some how it does not stop there.
I was on the latest node version, using the node-debug command (to launch node-inspector and having the same issues you were. Here's what I'm rolling with currently:
Using the following versions:
Start your tests using the following command:
Navigate to your test file and start putting in breakpoints, then hit run. I usually put one up by the 'requires' of my test file, and several within my 'it' functions.
Hope that helps, and that one day this kind of thing will just work :P
Got the idea to downgrade node from here: https://www.bountysource.com/issues/7978672-script-is-resumed-as-soon-as-node-inspector-is-loaded
And the command from here: https://github.com/node-inspector/node-inspector#how-do-i-debug-mocha-unit-tests
Try placing a breakpoint at the bottom of the mocha library per this issue. For some reason that allows
debugger
statements in your modules to pause the node debugger.However it doesn't seem to stop at debugger statements in the spec itself. I have a SO question highlighting that problem.