Mar*_*lef 5 mocha.js electron visual-studio-code spectron
我正在使用Spectron,mocha和chai-as-promise运行测试.我的IDE是Visual Studio Code.
我从测试中启动应用程序如下:
this.app = new Application({
path: electron,
args: ['.']
});
// Then at some point I run this.app.start()
Run Code Online (Sandbox Code Playgroud)
我可以将Visual Studio Code调试器连接到此应用程序吗?我可以运行调试我的测试代码,但我需要在某个时候调试应用程序.
是的,您可以使用 VsCode 调试测试。
为了启用调试,您应该向launch.json添加特定配置,如下所示。
{
"name": "Debug Test Process",
"type": "node",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"args": [
"--timeout",
"999999",
"--colors",
]
}
Run Code Online (Sandbox Code Playgroud)