使用 Visual Studio Code 调试摩卡蛋糕-2



我有一个节点.js项目用mocha.js测试。我使用摩卡蛋糕-2以黄瓜风格编写我的测试。

这是我的包.json

"devDependencies": {
"chai": "^4.1.2",
"chai-spies": "^1.0.0",
"mocha": "^5.2.0",
"mocha-cakes-2": "^3.3.0",
"should": "^13.2.3",
"should-sinon": "0.0.6",
"sinon": "^6.3.4"},"scripts": {"test": "mocha ./scenarios/**/*.test.js --ui mocha-cakes-2"}

这是我在VS代码中的launch.json

{
"type": "node",
"request": "launch",
"name": "Mocha All",
"program": "${workspaceFolder}/tests/node_modules/mocha/bin/_mocha",
"args": [
"--timeout",
"999999",
"--colors",
"'${workspaceFolder}/tests/scenarios/**/*.test.js'"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}

当我运行测试时,一切正常。但是当我使用 VS Code 调试测试时,出现以下错误。引用错误:未定义功能

如何配置 VS Code 调试选项以将摩卡蛋糕-2 设置为摩卡的 UI?

我想这应该通过传递ui参数来工作

{
"type": "node",
"request": "launch",
"name": "Mocha All",
"program": "${workspaceFolder}/tests/node_modules/mocha/bin/_mocha",
"args": [
"--ui", // add it here
"mocha-cakes-2", // add it here
"--timeout",
"999999",
"--colors",
"'${workspaceFolder}/tests/scenarios/**/*.test.js'"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}

相关内容

  • 没有找到相关文章

最新更新