【问题标题】:How to debug while testing in sailsjs在sailsjs中测试时如何调试
【发布时间】:2019-07-21 20:10:33
【问题描述】:

我正在尝试在sailsjs 中调试500 内部服务器错误。我已经用 mocha 编写了测试,并且从那里得到了错误。当我使用 npm run test 开始测试时,我不确定如何运行调试器。

我从另一个文件中得到错误,是否可以在那里放置断点并在测试时查看它

感谢您的帮助

【问题讨论】:

    标签: node.js visual-studio-code mocha.js sails.js


    【解决方案1】:

    所以,这就是我想出的解决方案。

    Using VScode,
    
    configure the launch.json to be
    
    {
      "version": "0.2.0",
      "configurations": [
        {
          "type": "node",
          "request": "launch",
          "name": "Mocha All",
          "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
          "args": [
            "--timeout",
            "999999",
            "--colors",
            "${workspaceFolder}/test/**/*.spec.js"
          ],
          "console": "integratedTerminal",
          "internalConsoleOptions": "neverOpen"
        },
        {
          "type": "node",
          "request": "launch",
          "name": "Mocha Current File",
          "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
          "args": ["--timeout", "999999", "--colors", "${file}"],
          "console": "integratedTerminal",
          "internalConsoleOptions": "neverOpen"
        }
      ]
    }
    

    根据项目中测试文件的标记方式进行更改

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-06-17
      • 1970-01-01
      • 1970-01-01
      • 2015-09-17
      • 1970-01-01
      • 1970-01-01
      • 2016-09-04
      • 2021-05-12
      相关资源
      最近更新 更多