Mocha breakpoints using Visual Studio Code

后端 未结 20 1301
星月不相逢
星月不相逢 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:25

    If you add ${file} variable at the end of the args list you can start debugging directly from the file you have open:

            {
                "type": "node",
                "request": "launch",
                "name": "Mocha Tests",
                "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
                "args": [
                    "-u",
                    "tdd",
                    "--timeout",
                    "999999",
                    "--colors",
                    "${file}"
                ],
                "internalConsoleOptions": "openOnSessionStart"
            }
    

提交回复
热议问题