Debugging Deno Projects in VSCode
Debugging Deno applications inside VS Code is actually pretty straightforward with the right launch config. Use the below .vscode/launch.json
config to debug your entire deno application, debug all of your deno tests, run a single test file, or just the specific test case that you have currently selected.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug Program",
"runtimeExecutable": "deno",
"runtimeArgs": [
"run",
"--inspect-brk",
"./src/main.ts"
],
"port": 9229,
"console": "integratedTerminal"
},
{
"type": "node",
"request": "launch",
"name": "Run Tests",
"runtimeExecutable": "deno",
"runtimeArgs": [
"test",
"--inspect-brk"
],
"port": 9229,
"console": "integratedTerminal"
},
{
"type": "node",
"request": "launch",
"name": "Debug Current Test File",
"runtimeExecutable": "deno",
"runtimeArgs": [
"test",
"${file}",
"--inspect-brk"
],
"port": 9229,
"console": "integratedTerminal"
},
{
"type": "node",
"request": "launch",
"name": "Debug Selected Test Case",
"runtimeExecutable": "deno",
"runtimeArgs": [
"test",
"${file}",
"--filter",
"${selectedText}",
"--inspect-brk"
],
"port": 9229,
"console": "integratedTerminal"
}
]
}