0

I am trying to debug mocha tests using visual studio code. I am using the attach method and it used to work. It looks like in the new version it attaches, halts on entry and then ignore all the breakpoints when I press continue.

Has anyone else had better luck with this?

Phil Whittaker
  • 434
  • 4
  • 20

1 Answers1

1

I answered a question similar to this one here: https://stackoverflow.com/a/40687741/4331142. In short, this is my VS Code launch.json file and I am able to debug mocha unit tests.

{
    // Use IntelliSense to learn about possible Node.js debug 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",
            "program": "${workspaceRoot}/server.js",
            "cwd": "${workspaceRoot}"
        },
        {
            "type": "node",
            "request": "attach",
            "name": "Attach to Process",
            "port": 5858
        },
        {
            "type": "node",
            "request": "launch",
            "name": "Debug Mocha Test",
            "port": 5858,
            "runtimeArgs": ["${workspaceRoot}/node_modules/mocha/bin/mocha"],
            "cwd": "${workspaceRoot}",
            "args": ["--recursive", "--debug-brk"]
        }
    ]
}
Community
  • 1
  • 1
P Walker
  • 532
  • 5
  • 15
  • What you did by posting an answer to this question goes against this site editorial practices. When you run into a question that asks the same thing as another question, the thing to do is to flag the question as duplicate (or vote for closure, but you cannot vote yet). Posting a duplicate answer is a "no no". – Louis Nov 19 '16 at 00:17
  • Thank you! I didn't realize that and will do that in the future. – P Walker Nov 19 '16 at 23:31