简体   繁体   中英

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? I can't seem to get it so that I set breakpoints and step in.

This launch.json config works for me:

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

I've tested it with typescript, and program works great for debugging.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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