The mocha.js repository has a build system that builds into /bin/mocha.
I don't use a package.json script. I just use a launch.json mocha test configuration:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha Tests",
"program": "${workspaceFolder}/bin/_mocha",
"args": [
"--colors",
"${workspaceFolder}/test/reporters/dina.spec.js"
],
"internalConsoleOptions": "openOnSessionStart"
}
]
}
- The program value has to be changed from the node_modules directory to the /bin directory. The top level file is supposed to be bin/_mocha but it won't debug.
- Remove any timeout args from the args array.
- Specify the exact file you want to debug into such as "dina.spec.js"