Enable the debugger
In VSCode, open the command palette, and search for "JavaScript Debug Terminal"
Set a breakpoint in your code:
Then, run your code normally with npm start
or npm run test
.
Skip Node-modules
.vscode/settings.json
{
"debug.javascript.terminalOptions": {
"skipFiles": [
"${workspaceFolder}/node_modules/**/*",
"<node_internals>/**"
]
}
}
Tests will time out
"test:mocha:debug": "nyc mocha --timeout 300000",
"test:jest:debug": "jest --testTimeout 300000"
Parallelism can bite you
"test:mocha:debug": "nyc mocha --timeout 300000 --jobs 1",
"test:jest:debug": "jest --testTimeout 300000 --maxWorkers 1"