I am trying to debug an existing set of unit tests that are run with tox. I updated my launch.json file to include the following configuration:
{
"module": "tox",
"name": "tox unit tests",
"request": "launch",
"type": "python",
"console": "integratedTerminal"
}
The tests run within vscode integrated terminal, but any breakpoints I set do not get hit so it doesn't seem like I have everything quite right.
How can I be able to catch breakpoints within my code?
Here is an example of one test structure:
class TestController(TestCase):
#patch("server.services.get", "")
def test_handle_item(self, mock_get):
a = controller.handle_item(MOCK_ID)
self.assertEqual(a, 2)
Related
I am having a super annoying problem, that started unexpected.
I have two NodeJS projects, and both projects uses TypeScript and they are symlinked. I usually debug by just attaching to the running process.
When debugging with VSCode, if I put a breakpoint in the projectA it work just fine, and the breakpoint is bonded to the actual TS file I want.
But then, I need call projectB from my projectA, and here the debugger goes directly to the projectA/node_modules/projectB/dist/**.js files, and shows that my TS files are breakpoint set but not yet bound.
This is kind of unexpected, since it was working before, and the debugger went directly to the projectA/node_modules/projectB/src/**.ts files.
I am not sure what happened, but I don't recall changing anything, and I also can't make it work again.
If I try debugging with WebStorm (attaching, just like I do with VSCode) it works just fine, this is only happening with VSCode.
I even tried to install VSCode Insiders, but no luck.
Node version: 14.16.1
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach",
"port": 9229,
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"runtimeArgs": ["--preserve-symlinks", "--preserve-symlinks-main"],
},
]
}
PS: Both projects has the sourceMaps: true defined in the tsconfig.json file
I want to set up my VS Code debugger to debug my Next.js app. My launch.json contains the below settings:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Launch Program",
"skipFiles": ["<node_internals>/**"],
"port": 9229,
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
"!**/node_modules/**"
]
}
]
}
I also added the debug script to my packege.json:
"debug": "NODE_OPTIONS='--inspect' next dev"
First, I run npm run debug in my terminal, then I launch the debugger in the VS Code Run and Debug tab. The debugger is attached, but when I start adding breakpoints, some of them work properly (the dot indicating the breakpoint is red and the app stops when the breakpoint is hit), but most of them are ignored despite the red indicator. There're also some unbound breakpoints.
I spent a few days figuring this out with no effect. I really look forward to moving past console-logging for debugging purposes.
VS Code version: 1.57.0
I am attempting to debug an electron app in vs code (the main process, not the renderer process). The project I am trying to debug is this repo:
https://github.com/hello-efficiency-inc/raven-reader
it works really nice, once you have it cloned, and the right things are installed. Then I can just run:
yarn electron:serve
And boom, it runs nicely.
But I would like to also debug this. So I look around a bit, and find that I should probably use this launch.json file in the .vscode directory:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Electron: Main",
"protocol": "inspector",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
"runtimeArgs": ["--remote-debugging-port=9223", "."],
"windows": {
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
}
}
]
}
In my package.json, I have this line for finding the startfile:
"main": "./src/background.js",
So, I try to run by clicking the debug icon, and then green triangle where it says
run and debug | Electron:Main
Which gives me this in the call stack menu:
But nothing actually seems like it's running, I dont see any desktop window which I would like so I can actually debug, and I can't hit my breakpoints either
Best way to sort this is to install code runner extension in vscode
My nextJS app have a path with 50k plus pages.
Running with npm run dev it works fine, but during build it gives me an error TypeError: Cannot read property 'page' of undefined at exportPaths.filter.route
That is weird, because I know how many paths I am trying to do (56,427) and they are fine.
I would really like to see where I messed up, but I can't launch a debugger for build stage ending with 'Starting inspector' multiple messages.
I have tried other ways, but with no success.
Here is my config, which is pretty obsolete, but seems straightforward:
{
"type": "node",
"request": "launch",
"name": "Next: Node",
"runtimeExecutable": "${workspaceFolder}/node_modules/next/dist/bin/next",
"env": {
"NODE_OPTIONS": "--inspect"
},
"args": ["build"],
"port": 9229,
"console": "integratedTerminal"
}
P.S. Debugging npm run dev works fine
P.P.S. trying to 'listen' to the debugger in VS Code and launching debugger from command line, like in here https://nextjs.org/docs/advanced-features/debugging gives me the same problems.
Node js Version :v8.11.3
VS Code version :1.29.1 x64
npm version :6.6.0
Hi ,
I have created a default express skeleton project using express --view=jade myapp command after that cd myapp/ and npm install in the last.
Now I am trying to attach vscode debugger to this newly created project but no luck.
This is the content of my launch.json
{
// 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": "Launch Program",
"protocol":"inspector",
"port":3000,
"program": "/home/pankaj/myfirstapp/myapp/app.js"
}
]
}
I am also not able to see any error in the debug console .There is nothing in debug console neither success nor failure.
Thanks In advance
Be careful for express default setup to set the path of program in launch.json to "program": "${workspaceFolder}/bin/www"
Port 3000 is the application port of your express application. If you specify this in your launch configuration, the VS Code debugger will try to use it as the debug port (which obviously cannot work).
In addition, use VS Code variables to specify where your programs lives. E.g. if you have opened VS Code on your myapp directory, use ${workspaceFolder}/app.js for the program attribute:
E.g.:
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/app.js"
}