What's the right way to enable the node debugger with mocha's --debug-brk switch?

后端 未结 5 608
北恋
北恋 2020-12-12 14:04

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. Unfort

5条回答
  •  执笔经年
    2020-12-12 14:15

    I was able to get this to work using node-inspector. I run my test like you show in one shell:

    mocha --debug-brk mocha/test.js
    

    and then run node-inspector in a second shell:

    node-inspector
    

    Bringing up the URL that node-inspector spits out in a browser allows me to debug with the web inspector.

    http://127.0.0.1:8080/debug?port=5858
    

提交回复
热议问题