vscode's Mocha test debug target broke with the latest changes to bin/_mocha
try debugging a test file with the following configuration in vscode:
{
"type": "node",
"request": "launch",
"name": "Debug Current Test",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"-u",
"tdd",
"--timeout",
"999999",
"--colors",
"${file}"
],
"internalConsoleOptions": "openOnSessionStart"
}
and you'll get errors like describe()
is not defined or before()
is not defined. Seems like mocha is not in the global scope when launched like this anymore. This works in pre 6.0.2 releases (e.g. 5.2).
mocha: 6.0.2
node: 11.10.0
OS: Ubuntu 18.04 64 bit
shell: ZSH
Delete -u
and tdd
flags in the args[]
, then it should work.
@juergba that worked! thanks. is this behavior documented somewhere? trying to figure out if there are other changes I need to be aware of.
Great! It's not really a change, describe()
and before()
are "BDD" style interface and you tried to debug with "TDD" style. "BDD" is default value, so you can omit -u bdd
.
Have a look at our release notes, you should be fine, since we haven't changed our API.
Most helpful comment
Great! It's not really a change,
describe()
andbefore()
are "BDD" style interface and you tried to debug with "TDD" style. "BDD" is default value, so you can omit-u bdd
.Have a look at our release notes, you should be fine, since we haven't changed our API.