Mocha breakpoints using Visual Studio Code

后端 未结 20 1353
星月不相逢
星月不相逢 2020-12-12 11:52

Is it possible to add breakpoints to ones Mocha tests using Visual Studio Code?

Normally when debugging code one need to configure the launch.json, setting the prog

20条回答
  •  忘掉有多难
    2020-12-12 12:28

    Another way is to use the --debug-brk command line option of mocha and the default Attach launch setting of the Visual Studio Code debugger.


    Suggested deeper explanation (from André)

    To do this:

    Run mocha from the command line using this command:

    mocha --debug-brk
    

    Now in VS Code click on the Debug icon, then select Attach from the option next to the start button. Add breakpoints in VS Code and then click start.

提交回复
热议问题