What is the difference between args and runtimeArgs in VSCode's launch.json?

I think this is mostly explained in the Node debugging docs:

Instead of launching the Node.js program directly with node, you can use 'npm' scripts or other task runner tools directly from a launch configuration:

  • Any program available on the PATH (for example 'npm', 'mocha', 'gulp', etc.) can be used for the runtimeExecutable attribute [...]

runtimeExecutable is not the program you want to debug, but the executable used to run it. So it appears that runtimeArgs is to runtimeExecutable as args is to program.

If you're interested in how it works in detail, here's the relevant part of the debugAdapter.ts implementation.


If you remove the attribute "program", the arguments are attached after another and you don't see any difference.

Consider following example, including "type" and "program":

         {
            
           "name": "vscode-jest-tests",
            "type": "node",
            "request": "launch",
            "program": "${workspaceFolder}/node_modules/jest-cli/bin/jest.js",
            "stopOnEntry": false,
            "args": [ 
                "--runInBand"                       
            ],
            "cwd": "${workspaceFolder}",
            "preLaunchTask": null,
            "runtimeExecutable": null,
            "runtimeArgs": [
                "--nolazy"
            ],
            "env": {
                "NODE_ENV": "development"
            },
            "console": "integratedTerminal",
            "internalConsoleOptions": "neverOpen",
            "disableOptimisticBPs": true
        }

=> set "NODE_ENV=development" && "C:\Program Files\nodejs\node.exe" --nolazy --inspect-brk=35238 node_modules\jest-cli\bin\jest.js --runInBand

  • The runtimeArg "--nolazy" occurs behind node.exe (corresponds to type) and

  • The arg "--runInBand" occurs behind jest.js (corresonds to program)

If you remove the attribute "program", the arguments are attached after another and you don't see any difference.