如何使用vscode进行调试来启动oclif测试?

时间:2020-10-04 23:54:01

标签: unit-testing visual-studio-code oclif

launch.json在调试模式下运行oclif项目测试是什么样子?我似乎无法理解它,所以我设置了断点并介入。

2 个答案:

答案 0 :(得分:0)

此launch.json配置适用于我:

{
  "type": "node",
  "request": "launch",
  "name": "Mocha Tests",
  "runtimeExecutable": "${workspaceFolder}/node_modules/ts-mocha/bin/ts-mocha",
  "args": [
    "${workspaceFolder}/test/**/*.ts"
  ],
  "protocol": "inspector"
},

答案 1 :(得分:0)

我从这里提供的回复中受益: https://github.com/oclif/oclif/issues/135#issuecomment-403622999

我已经用打字稿测试过了,program非常适合调试。

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Launch Program",
      "program": "${workspaceFolder}/bin/run",
      "args": [
        "--name",
        "Callum",
        "--force",
        "argument"
      ]
    }
  ]
}