Debugging Mocha
Using Node Debugger with Mocha
Assumption
Your package.json that has the following lines:
scripts: {
"mocha": "mocha"
}Steps
nodejs
v6.3.0and mochav3.1.0you can use V8 inspector integration
--inspectactivates V8 inspector integration--debug-brkadds a breakpoint at the beginningYou can run:
npm run mocha -- --inspect --debug-brk
nodejs
v7.6.0and mochav3.3.0You can run:
npm run mocha -- --inspect-brk--inspect-brkis a shorthand for --inspect --debug-brk
References
Last updated