I installed bun.js vs code plugin and have some success debugging typescript files with provided config.
Also able to debug one test file if I set program:${file}
But there is no launch.json example how to debug or just run all tests
config that I'm using, breakpoints not always work but so far it's okish
{
"type": "bun",
"request": "launch",
"name": "Debug Bun",
"program": "${file}",// just open *.test.ts file and this line will allow you to debug current test file
"args": [],
"cwd": "${workspaceFolder}",
"env": {},
"strictEnv": false,
"watchMode": false,
"stopOnEntry": false,
"noDebug": false,
"runtime": "bun",
},
Would be cool to make test explorer work with bun somehow too If someone know how to add a hotkey to restart previous test that would help a lot
So... I kind of managed to do it. Here's what I've got:
Bun: v1.1.18
VS Code: v1.91.1
Bun for Visual Studio Code Extension (oven.bun-vscode): v0.0.12
Using this config in .vscode/launch.json file in workspace:
{
"version": "0.2.0",
"configurations": [
{
"type": "bun",
"internalConsoleOptions": "neverOpen",
"request": "launch",
"name": "Debug File",
"program": "${file}",
"cwd": "${workspaceFolder}",
"stopOnEntry": false,
"watchMode": false
},
{
"type": "bun",
"internalConsoleOptions": "neverOpen",
"request": "launch",
"name": "Run File",
"program": "${file}",
"cwd": "${workspaceFolder}",
"noDebug": true,
"watchMode": false
},
{
"type": "bun",
"internalConsoleOptions": "neverOpen",
"request": "attach",
"name": "Attach Bun",
"url": "ws://localhost:6499/",
"stopOnEntry": false
}
]
}
Run and Debug panel.

bun test --inspect-wait=localhost:6499/ your-fileThis is hacky, but works. It allows you to run or debug a single test easily:

firsttris.vscode-jest-runner extension"settings": {
// ...
"jestrunner.jestCommand": "bun test",
"jestrunner.jestPath": "${file}",
"jestrunner.debugOptions": {
"runtimeExecutable": "bun",
"runtimeArgs": ["test", "--inspect-wait=localhost:6499/"]
}
// ...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With