如何使用VS Code配置Mocha

时间:2019-10-19 14:19:38

标签: testing visual-studio-code mocha

嗨,我正在尝试使用Visual Studio Code设置Mocka和Chai框架,但是在尝试运行摩卡单元测试时却出现错误消息:

属性“程序”不存在('C:\ Users ... node_modules / mocha / bin / _mocha')

http://prikachi.com/images/321/9672321w.png

必须是设置中的内容。 这是VS Code launch.json的JSON配置文件

{
// 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": "Mocha Tests",
        "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
        "args": [
            "-u",
            "bdd",
            "--timeout",
            "999999",
            "--colors",
            "${file}"
        ],
        "internalConsoleOptions": "openOnSessionStart"
    },
    {
        "type": "node",
        "request": "launch",
        "name": "Launch Program",
        "program": "${file}"
    }
]

}

0 个答案:

没有答案