Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
76
rated 0 times [  81] [ 5]  / answers: 1 / hits: 53525  / 12 Years ago, wed, january 16, 2013, 12:00:00

I have some debugger statements in my module under test and want to run mocha with --debug-brk set and hit my breakpoint so that I can inspect the state of my module. Unfortunately, whenever I run mocha with this option, I end up with a blank cursor on the next line. I can enter text, but there's nothing that appears to be processing my commands (it certainly doesn't look like the node debugger):


$ mocha --debug-brk tests.js -R spec
debugger listening on port 5858
[BLANK CURSOR]

Am I doing something wrong with how I'm launching mocha?


More From » node.js

 Answers
6

To answer the original question, even though I also suggest you look into node-inspector: you can use the CLI debugger built into node through mocha with the debug option, instead of the --debug or --debug-brk flags. (Notice the lack of dashes.)



In your example, instead, it would be:



$ mocha debug tests.js -R spec
debugger listening on port 5858
connecting... ok
break in node_modules/mocha/bin/_mocha:7
5 */
6
7 var program = require('commander')
8 , sprintf = require('util').format
9 , path = require('path')
debug> [CURSOR]


Again, debug as above in bold, with no dashes. (=



Relevant: https://github.com/visionmedia/mocha/issues/247


[#80838] Tuesday, January 15, 2013, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
felixa

Total Points: 180
Total Questions: 113
Total Answers: 108

Location: Palau
Member since Sat, Aug 21, 2021
3 Years ago
;