how do you launch oclif tests with debugging using vscode?

493 views Asked by At

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.

2

There are 2 answers

0
Ken On

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"
},
0
cyrf On

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