CrabDude / babel-node-debug

node-inspector's node-debug using babel-node
MIT License
91 stars 11 forks source link

Using with mocha? #10

Open olalonde opened 8 years ago

olalonde commented 8 years ago

Anyone has any idea on how to use it with mocha? I've tried mocha --debug-brk but it doesn't seem to work out of the box.

jeremyckahn commented 8 years ago

I would also love to know how to do this.

CrabDude commented 8 years ago

For more complex workflows like mocha, I would recommend foregoing the utility that is babel-node-debug and opt instead for the more manually workflow:

  1. Follow the Babel setup for use with mocha.
  2. Run your code in debug mode (See here for mocha)
  3. Run node-inspector
  4. Visit the node-inspector URL in Chrome: http://127.0.0.1:8080/debug?port=5858

I'll leave this issue open if you can specifically propose a way to make that workflow better in a manner that relates to babel-node-debug. I don't immediately see where this library would fit into that workflow.

jeremyckahn commented 8 years ago

I have a workable-ish solution for this use case here: https://github.com/jeremyckahn/rekapi/blob/784471e41fd329b57e9a75b9e166117b8c0107e5/task.sh#L33-L40

I just run sh task.sh test-debug-ui and off it goes. Pressing the Enter key kills all of the Node processes.

Could certainly be better, but I at least have a graphical debugger for my ES6 code. The Mocha tests need to be ES5, though, as far as I can tell.