Debug LWC Jest Tests with VS Code

It's as easy as adding a launch.json in the .vscode folder.

{
    // 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": "Jest Tests",
        "program": "${workspaceRoot}/node_modules/.bin/jest",
        "cwd": "${workspaceRoot}",
        "args": ["-i", "--runInBand", "${relativeFile}", "--no-cache"]
      }
    ]
  }
  

On the left select the debug menu, and the play while viewing the .spec.js file you wish to debug. Be sure to place a breakpoint first.