debugging mocha tests
2016-11-13
Today I learnt new about debugging mocha tests.
The following is how I debugged using Microsoft’s awesome VSCode editor
In the root of your project, create a folder with the following name .vscode
Within that folder, create a file named launch.json
Open your launch.json
and add the following configuration:
|
|
From your projects root, run your test runner with the debug argument like
|
|
Or if you’ve created a debug script in your package.json
like
|
|
then run it like
|
|
In your vscode editor, switch over to the debug panel on the left-hand side and start the debugger.
Adding breakpoints in the test code will cause the runner to pause giving you all the time you need to debug you tests!!