0

I am setting up nyc/mocha for my project. I want to pass --exit option to mocha when running mocha with/without nyc.

Here's my packages.json:

"scripts": {
    "start": "node ./app",
    "test": "./node_modules/.bin/mocha --exit",
    "test-with-coverage": "nyc --reporter=html mocha --reporter mochawesome --exit",
    "apidoc": "apidoc -i routes/ -o apidocs/"
  }

But this throws invalid option error when I run npm test or npm run test-with-coverage.

How do you pass any options to mocha from npm?

Sumit Jain
  • 1,484
  • 2
  • 25
  • 44

1 Answers1

1

The only reason I can see for having the problem with the code you show is that --exit was added in Mocha 4.0.0 and you happen to be using an older version.

Louis
  • 146,715
  • 28
  • 274
  • 320