如何在制作 nyc 覆盖率报告时使用 VSCode 进行调试?

How to debug with VSCode when making a nyc coverage report?

我正在尝试在 运行ning nyc 时进行调试,而不是在 运行ning 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"
    }

兄弟,我支持你。

自从纽约市 运行s 以来,子进程作为衍生品就无法正常工作。但是您可以 运行 一个所谓的复合启动,实际上 运行s 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"]
      }
    ]
}

您将在调试 运行 列表中看到 NYC/Mocha