VS Code proving to be a very capable editor to me. In this post I will go over the steps to debug Mocha unit tests for NodeJs in VS Code.
Let’s assume you have all your tests under a folder called test.
- Create a launch.json file and add a new task named Run Mocha.
- Install Mocha globally using the command npm install mocha -g
- Configure the VS Code task as below in the launch.json file.
Put a debug point and run the task.