【发布时间】:2018-09-25 15:46:25
【问题描述】:
我想使用 VS Code 来编辑和调试 Cypress 测试。 cypress 文档 mention VS Code directly,但没有提供任何关于如何配置 VS Code 的 launch.json 文件以便在那里或调试页面上进行调试的线索。
我有一个启动 cypress/electron 的 launch.json 配置,但是 VS Code 给出了这个错误:
无法连接到运行时进程...连接 ECONNREFUSED 127.0.0.1:5858
然后关闭它。
查看sample electron for VS Code project 没有帮助,添加protocol 或program 属性也不起作用。
这是我的配置:
{
"name": "Start integration_tests",
"type": "node",
"request": "launch",
"stopOnEntry": false,
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/cypress",
"runtimeArgs": [
"open"
],
"console" : "internalConsole",
"port": 5858,
}
【问题讨论】:
-
Cypress 建议使用他们的调试器,也许这会对您有所帮助? docs.cypress.io/guides/guides/debugging.html#Using-debugger
-
那篇文章似乎 建议在调试语句中添加将触发 chrome 开发工具打开的语句。我更喜欢在编写测试的 IDE 中进行调试。
-
是的,确实如此。我没有看到有人在 VS 中调试 cypress,所以我把它作为一个选项扔给你。
-
@Brendan 再强调一点,当我使用调试器时,我看到开发工具中的编译代码与我们编写的测试不同。
标签: visual-studio-code cypress