I have created a public repository to demonstrate this not working in a basic module that simply contains one mocha test file and a script to run said file through mocha with debugger attached:
https://github.com/corey-cosman/mocha-test-debug
to reproduce:
git clone git@github.com:corey-cosman/mocha-test-debug.git
npm install
npm run test:debug
expected:
that this test file runs and stops on breakpoint
actual:
the debugger attaches and listens on port 127.0.0.1:9229, but mocha file does not run
package.json
:
{
"name": "mocha-test-debug",
"version": "1.0.0",
"description": "",
"main": "test/mocha-test-debug.js",
"scripts": {
"test:debug": "mocha -- --inspect-brk ./test/mocha-test-debug.js"
},
"devDependencies": {
"mocha": "^7.2.0"
}
}
test/mocha-test-debug.js
:
describe('mocha test debug', function () {
it('should run test and hit breakpoint', async function () {
debugger
});
});
As mentioned, this has been working for a while and stopped very recently, noticed yesterday. Any help is greatly appreciated. Thanks!