【问题标题】:Visual studio code debug mocha tests [duplicate]Visual Studio代码调试摩卡测试[重复]
【发布时间】:2016-01-26 17:53:19
【问题描述】:

我正在尝试使用 Visual Studio 代码调试 mocha 测试。我正在使用附加方法,它曾经可以工作。它看起来像在它附加的新版本中,在进入时停止,然后在我按继续时忽略所有断点。

还有其他人比这更好吗?

【问题讨论】:

    标签: mocha.js visual-studio-code


    【解决方案1】:

    我在这里回答了一个类似的问题:https://stackoverflow.com/a/40687741/4331142。简而言之,这是我的 VS Code launch.json 文件,我可以调试 mocha 单元测试。

    {
        // 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": "Launch Program",
                "program": "${workspaceRoot}/server.js",
                "cwd": "${workspaceRoot}"
            },
            {
                "type": "node",
                "request": "attach",
                "name": "Attach to Process",
                "port": 5858
            },
            {
                "type": "node",
                "request": "launch",
                "name": "Debug Mocha Test",
                "port": 5858,
                "runtimeArgs": ["${workspaceRoot}/node_modules/mocha/bin/mocha"],
                "cwd": "${workspaceRoot}",
                "args": ["--recursive", "--debug-brk"]
            }
        ]
    }
    

    【讨论】:

    • 您发布此问题的答案的做法违反了本网站的编辑惯例。当您遇到与另一个问题提出相同问题的问题时,要做的是将问题标记为重复(或投票支持关闭,但您还不能投票)。发布重复的答案是“不”。
    • 谢谢!我没有意识到这一点,将来会这样做。
    猜你喜欢
    • 1970-01-01
    • 2019-08-20
    • 1970-01-01
    • 2015-08-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-27
    相关资源
    最近更新 更多