我正在尝试设置一个调试配置,以便在使用Mocha的Node应用程序中运行测试。 我将Ubuntu作为Linux的Windows子系统运行,并且我的Visual Studio代码设置为使用Bash作为集成终端。使用Windows子系统为Linux进行Visual Studio代码调试
这里是我的launch.json
配置:
{
"name": "Launch via NPM",
"type": "node",
"request": "launch",
"console": "integratedTerminal",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "npm",
"runtimeArgs": [
"test"
],
"protocol": "inspector",
"port": 5858
...
}
这将运行我的综合终端的测试,但总是会超时当试图连接到调试器,并出现以下错误:
Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:5858).
而且,这里是它显示了在终端b在它开始运行测试之前:
任何想法如何确保它连接调试器?
请问,如果你更改端口工作?尝试设置'diagnosticsLogging:true'并检查日志。 –
尝试了不同的端口。另外'diagnosticLogging'属性是不允许的 – Alkasai