我正在尝试在Visual Studio Code中使用业力调试测试(为此,我还添加了Chrome调试器)我已将此添加到我的业力配置文件中:
customLaunchers: {
Chrome_with_debugging: {
base: 'Chrome',
flags: ['--remote-debugging-port=9222'],
debug: true
}
},
而且我的launch.json看起来像:
configurations": [
{
"name": "Debug tests in Chrome",
"type": "chrome",
"request": "attach",
"port": 9222,
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
}
]
我可以使用karma start karma.conf.ts --browsers Chrome_with_debugging
进行测试;这将打开浏览器,但之后立即关闭窗口(因此,我什至无法将调试器附加到因果进程上)我可以运行karma start karma.conf.ts --browsers Chrome_with_debugging --single-run=false
,这将打开窗口(无需运行测试),并且可以连接调试器。但是,如果我在窗口上按Debug(调试),则测试会运行,但无法达到任何断点我搜索过的大多数有关业力启动的解决方案已经假设运行测试后窗口没有关闭,因此您可以连接调试器并重新运行(不是我的情况)
如何正确设置?
添加--watch
选项并在窗口开始打开开发人员工具时点击F12
: