Debugging Mocha Tests in VSCode

less than 1 minute read

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.

  1. Create a launch.json file and add a new task named Run Mocha.
  2. Install Mocha globally using the command npm install mocha -g
  3. Configure the VS Code task as below in the launch.json file.

Put a debug point and run the task.

Leave a Comment