samedi 9 janvier 2016

How do I run javascript tests using debugger; statements?

There doesn't seem to be a universal answer for this, nor is it asked on Stack Overflow. I come from a Python background where I can use import pdb; pdb.set_trace() in my code and immediately walk through code using a debugger. How can I do this in NodeJS?

For instance, I'm trying to run and debug tests in Browserify Shim. This uses npm's tap testing framework. To run the tests, I need to run npm run test-main from Browserify-shim's root directory.

If I add a debugger; statement in the code or the tests, nothing happens. I've tried running npm run test-main --debug as well as npm run test-main --debug-brk to no avail.

What is the correct way to effectively step through code in NodeJS?

Aucun commentaire:

Enregistrer un commentaire