Skip to content

--inspect flag doesn't work #3681

Closed
Closed

Description

When I tried to debug mocha with --inspect option, ReferenceError: describe is not defined error occurred.
It seems it is not run under mocha context.

$ ./node_modules/.bin/mocha --version
6.0.0-1

$ ./node_modules/.bin/mocha --inspect ex.test.js
Debugger listening on ws://127.0.0.1:9229/aca2ad85-76ab-42ac-99bc-6acb84bd1bc2
For help, see: https://nodejs.org/en/docs/inspector
/Users/outsider/temp/mocha-next/6/ex.test.js:1
(function (exports, require, module, __filename, __dirname) { describe('Suite', () => {
                                                              ^

ReferenceError: describe is not defined
    at Object.<anonymous> (/Users/outsider/temp/mocha-next/6/ex.test.js:1:63)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)

With mocha@5.2.0, it is fine.

$ ./node_modules/.bin/mocha --version
5.2.0

$ ./node_modules/.bin/mocha --inspect ex.test.js
Debugger listening on ws://127.0.0.1:9229/4b56feea-1711-43bd-82a3-5a587171122f
For help, see: https://nodejs.org/en/docs/inspector


  Suite
    ✓ test


  1 passing (5ms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    area: node.jscommand-line-or-Node.js-specifictype: buga defect, confirmed by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions