Mocha: Mocha 6.0.2 release breaks vscode debugger

Created on 1 Mar 2019  ·  3Comments  ·  Source: mochajs/mocha

Description

vscode's Mocha test debug target broke with the latest changes to bin/_mocha

Steps to Reproduce

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).

Versions

mocha: 6.0.2
node: 11.10.0
OS: Ubuntu 18.04 64 bit
shell: ZSH

integration invalid question

Most helpful comment

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.

All 3 comments

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.

Was this page helpful?
0 / 5 - 0 ratings