Did*_*hen 12 node.js visual-studio-code nyc
我正在尝试在运行nyc时进行调试,而不是仅在运行Mocha测试时进行调试,因此我不必每次都运行两次测试。
VSCode运行覆盖并将其显示给我,但是它不会停止或验证断点,如何设置它以进行正确调试?
可能吗
我的启动配置:
{
"type": "node",
"request": "launch",
"name": "Coverge",
"program": "/usr/local/bin/nyc",
"args": [
"${workspaceFolder}/node_modules/mocha/bin/_mocha",
"-u",
"tdd",
"--timeout",
"999999",
"--colors",
"${workspaceFolder}/tests/*/*"
],
"skipFiles": [
"${workspaceFolder}/node_modules/**/*.js"
],
"env": {},
"outputCapture": "std",
"internalConsoleOptions": "openOnSessionStart"
}
Run Code Online (Sandbox Code Playgroud)
我支持你了,兄弟。
由于 NYC 将子进程作为衍生运行,因此它无法工作。但是您可以运行所谓的“复合启动”,它实际上运行 2 个进程,第一个进程连接到等待的第二个进程,侦听端口(默认情况下为 9229),然后瞧。
{
// Use IntelliSense to learn about possible 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": "Coverage",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/node_modules/.bin/nyc",
"args": [
"-x","test","--reporter=lcov","--reporter=text",
"node", "--inspect-brk",
"./node_modules/.bin/mocha", "test", "--recursive", "--timeout=300000"
]
}
,
{ // https://code.visualstudio.com/Docs/editor/debugging#_launch-versus-attach-configurations
"type": "node",
"name": "AttachMocha",
"request": "attach",
"port": 9229
}
],
// https://code.visualstudio.com/Docs/editor/debugging#_compound-launch-configurations
"compounds": [
{
"name": "NYC/Mocha",
"configurations": ["AttachMocha", "Coverage"]
}
]
}
Run Code Online (Sandbox Code Playgroud)
您将在调试运行列表中看到NYC/Mocha 。
归档时间: |
|
查看次数: |
460 次 |
最近记录: |