SharpCoder
SharpCoder

Reputation: 19193

Debugging JavaScript code on Sublime using mocha

I have written some test cases and executing them using mocha. I am using sublime as the editor. When I run the test cases (using mocha), I want to add debugging points and want to see what is happening. If not SubLime, is there any way to execute these test case on browser and add breakpoints in browser?

If this approach is not practical what other alternatives I have?

Thank You

Upvotes: 2

Views: 1028

Answers (1)

Laurent Perrin
Laurent Perrin

Reputation: 14881

You can use node-debug:

npm install -g node-inspector

Then:

node-debug _mocha test.js

It will open Chrome with the Web Inspector, ready to debug your app.

One problem you'll have is that, as the test isn't started yet, your files won't be loaded. You can add debugger; statements in your code to force breakpoints.

Upvotes: 3

Related Questions