mocha: Certain mocha command line options not working

I’m baffled by this. I have mocha 2.2.5 installed globally

Running:

mocha --bail

give the error:

  error: unknown option `--bail'

Other options work fine like

mocha -V
mocha --help
mocha --trace

Then some other options give the same error as --bail

mocha --watch
 error: unknown option `--watch'

mocha --no-timeouts
error: known option `--no-timeouts`

Any clue what could be causing this? I’m using Node v0.12.6

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 1
  • Comments: 15 (4 by maintainers)

Most upvoted comments

Actually, I think I found the issue. I was using the commander package to add CLI functionality. Removing the package (and the commander specific code) seems to have fixed the problem. I’ll whip up a test case and file another issue.

Edit: In my case, it seems like the issue is arising because I’m using the rewire module to include unexported functions from the script that invokes commander. Moving those functions to a utility functions file and then testing that should fix the issue I was seeing.

This appears solved.

Solved for me: the error was not from mocha, it was a wrong check of args in my test (something changed in commander) that produced the error.