Is there a way to start the debugger when an exception or testing error occurs in node.js?

What I'm looking for is mainly nosetest --pdb --pdb-failuresfrom the scope of nose testing .

I use mocha for testing. What I would like to do is run tests like

mocha --break-on-exception --break-on-failure, which will stop running the tests once it encounters an exception or statement error, would launch a node-inspector for me and let me figure out the runninng code.

Is this possible anywhere in the world of node.js, with any library or test platform?

+4
source share
1 answer

add this line to your test:

if (global.v8debug)
   global.v8debug.Debug.setBreakOnException()

mocha --debug-brk, node -,

+5

All Articles