D
Deno

help

VSCode Test Debugging

IIndustrial10/23/2023
{
"name": "Test",
"request": "launch",
"type": "node",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "deno",
"runtimeArgs": [
"test",
"--unstable",
"--inspect-brk",
"--allow-all"
],
"attachSimplePort": 9229
}
{
"name": "Test",
"request": "launch",
"type": "node",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "deno",
"runtimeArgs": [
"test",
"--unstable",
"--inspect-brk",
"--allow-all"
],
"attachSimplePort": 9229
}
This doesn't work unless I add:
"program": "${workspaceFolder}/src/foo/bar.test.ts",
"program": "${workspaceFolder}/src/foo/bar.test.ts",
When I run without, I see that a process starts but it does nothing. How do I run all tests with a debugger? I just want to set a breakpoint and press run. I don't want to have to edit the config to test 1 specific file.
DAHDeno AI Helper10/23/2023
The documentation provides information on how to use the debugger with Deno in Visual Studio Code. According to the documentation, you can generate a configuration by going to the Run and Debug panel, clicking create a launch.json file and selecting Deno option from the available debugger options. However, the documentation does not provide a clear answer on how to run all tests with a debugger without specifying a specific file in the program field of the configuration. As a general advice (which is not explicitly stated in the documentation), you might want to try using a wildcard (*) in the program field to include all test files in a certain directory, like so:
"program": "${workspaceFolder}/src/**/*.test.ts",
"program": "${workspaceFolder}/src/**/*.test.ts",
This should theoretically run all test files in the src directory and its subdirectories. However, please note that this advice is not explicitly supported by the documentation and might not work as expected. If you continue to experience issues, it might be helpful to debug the issue further by checking the output logs or asking for help in the Deno community. 🦕
LLeokuma10/24/2023
Enable the setting deno.codeLens.test and a "Debug" option should appear right above the tests in your code

Looking for more? Join the community!