我正在尝试使用 VS Code 调试 nightwatch e2e 测试。我使用打字稿编写测试。只有当我在 js 文件中放置断点时它才能工作,之后它会转到 ts 文件,我可以从那里调试它。如果我把它放在我的测试的 ts 文件中 - 它永远不会停止,并且写着“”因为找不到生成的代码而忽略了断点”。我的源文件是使用 ts 编译器编译到文件夹 /dist/dev/specs/e2e/nightwatch /src.launch.json 中的代码
"name": "Launch e2e Tests on chrome",
"type": "node",
"console": "integratedTerminal",
"program": "${workspaceRoot}/dist/dev/specs/e2e/nightwatch/nightwatch.js",
"stopOnEntry": false,.
"args": ["-env default,-f DatabaseChecks.js"],
"cwd": "${workspaceRoot}",
"runtimeExecutable": null,.
"runtimeArgs": ["--nolazy"],
"env": {
"NODE_ENV": "development"
},
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/dist/dev/specs/e2e/nightwatch/src"],
"request": "launch"
也许有人有类似的问题?任何帮助,将不胜感激。
在我的例子中,以下工作就像魅力一样。
这是项目结构。 https://i.stack.imgur.com/97ELC.png以下是我的 launch.json。
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Nightwatch",
"program": "${workspaceRoot}/node_modules/nightwatch/bin/runner.js",
"stopOnEntry": false,
"args": [
"--test",
"tests/functionality_e2e_test.js"
],
"runtimeExecutable": null,
"sourceMaps": false
},
{
"type": "node",
"request": "attach",
"name": "Attach to Process",
"port": 5858
}
]
}
上面的代码是在 Visual Studio Code 最新版本 1.21.1 中调试 Nightwatch js 项目的最低要求。我使用的是node.js v6.11.2。所以调试协议是遗留的。
谢谢堆栈溢出。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)