babel-node-debug icon indicating copy to clipboard operation
babel-node-debug copied to clipboard

Using with mocha?

Open olalonde opened this issue 9 years ago • 3 comments

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.

olalonde avatar Jan 07 '16 19:01 olalonde

I would also love to know how to do this.

jeremyckahn avatar Feb 02 '16 20:02 jeremyckahn

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.

CrabDude avatar Feb 05 '16 03:02 CrabDude

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.

jeremyckahn avatar Feb 05 '16 16:02 jeremyckahn