As I haven't solved my other issue yet Randomly failing tests jest and supertest Node.js I've decided to use the VS Code
debugger. I thought that it would be pretty simple but after I've set a breakpoint at the certain line and run the debugger I find my breakpoint icon in a different place and my code stops there.
My launch.json file:
{ "type": "node", "request": "launch", "name": "Jest Current File", "program": "${workspaceFolder}/node_modules/jest/bin/jest", "args": ["${relativeFile}"] }
Before:
After:
Any idea why this happens?
Run to a breakpoint in code To set a simple breakpoint in your code, select the far-left margin next to the line of code where you want to suspend execution. You can also select the line and then select F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert Breakpoint.
Jump to a breakpointPress Ctrl+Alt+F9 or choose ReSharper | Navigate | Breakpoints… from the main menu . Alternatively, you can press Ctrl+Shift+A , start typing the command name in the popup, and then choose it there.
You can also click on the line you want to skip to and hit Ctrl+F10 (Run to Cursor). It will jump directly to that line.
Inline breakpoints# This is particularly useful when debugging minified code which contains multiple statements in a single line. An inline breakpoint can be set using Shift+F9 or through the context menu during a debug session. Inline breakpoints are shown inline in the editor.
Generally in some IDEs, the breakpoints are fixed to the line number. So if code in that file changes after the breakpoint is set, the breakpoint doesn't move. So when making changes,
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