简体   繁体   English

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

[英]how do you launch oclif tests with debugging using vscode?

What does the launch.json look like to run oclif project tests in debug mode?在调试模式下运行 oclif 项目测试的 launch.json 是什么样的? I can't seem to get it so that I set breakpoints and step in.我似乎无法理解,所以我设置了断点并介入。

This launch.json config works for me:这个 launch.json 配置对我有用:

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

I benefitted from the response provided here: https://github.com/oclif/oclif/issues/135#issuecomment-403622999我从这里提供的回复中受益: https : //github.com/oclif/oclif/issues/135#issuecomment-403622999

I've tested it with typescript, and program works great for debugging.我用打字稿测试过它, program非常适合调试。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM