0

I have a node.js project tested with mocha.js. I use mocha-cakes-2 to write my test in cucumber style.

This is my package.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"}

This is my launch.json in VS Code

{
          "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"
      }

When I run the tests everything works perfectly. But when I debug the tests with VS Code I get the following error. ReferenceError: feature is not defined

How can I configure VS Code debug options to set mocha-cakes-2 as the UI for mocha?

4

1 回答 1

0

我想这应该通过传递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"
}
于 2018-10-08T03:55:19.057 回答