question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VSCode doesn't hit breakpoint (running via node `tsdx/dist/index.js test`)

See original GitHub issue

Hi, I need a little help here, I am trying to debug jest tests using VScode debugger. when running the debug mode, the application runs smoothly without hitting and stoping on breakoints.

this is my launch.json

    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Jest Test",
            "program": "${workspaceFolder}/node_modules/tsdx/dist/index.js",
            "args": [
                "test"
            ],
            "console": "integratedTerminal",
            "internalConsoleOptions": "neverOpen",
            "outFiles": ["${workspaceFolder}/dist"],
            "protocol": "inspector",

        }
    ]

Am I missing somehting?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11

github_iconTop GitHub Comments

12reactions
agilgur5commented, Mar 18, 2020

Ok tried this out myself on one of my libraries and got it to work without much fuss. My launch.json has some differences:

        "version": "0.2.0",
        "configurations": [{
            "name": "Node.js: Debug TSDX Jest Tests",
            "type": "node",
            "request": "launch",
            "runtimeArgs": [
                "--inspect-brk",
                "${workspaceRoot}/node_modules/tsdx/dist/index.js",
                "test",
                "--runInBand"
            ],
            "console": "integratedTerminal",
            "internalConsoleOptions": "neverOpen",
            "port": 9229
        }]

Notably, --inspect-brk and that I didn’t change the default program (from node) and instead added ${workspaceRoot}/node_modules/tsdx/dist/index.js to the args after --inspect-brk

Idk if this follows best practices but it does work

2reactions
or2008commented, Mar 18, 2020

yes! works perfectly. thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debug Node.js Apps using Visual Studio Code
The Visual Studio Code editor includes Node.js debugging support. Set breakpoints, step-in, inspect variables and more.
Read more >
Visual Studio Code - Node debugger breakpoints not being hit
1 , the fix that worked for me was: Disable debug.javascript.usePreview via Code > Preferences > Settings. Add "localRoot": "${workspaceFolder}/ ...
Read more >
The Absolute Easiest Way to Debug Node.js - with VS Code
Unlike JavaScript in the browser, or Java with a powerful IDE like IntelliJ, you can't just set breakpoints everywhere, refresh the page or ......
Read more >
How To Debug Node.js Code in Visual Studio Code
For this tutorial, you can apply the lessons to one of your JavaScript projects that can be run on a Node server. There...
Read more >
How to debug Node.js apps in Visual Studio Code
Learn how to debug your Node.js applications with Visual Studio Code, even with languages transpiling to JavaScript.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found