Is there a .mocha file where I can specify default values โ€‹โ€‹such as -no-colors?

I would like to set some default values โ€‹โ€‹for mocha without typing them every time. Mocha is looking for the / dotfile configuration file anywhere since jshint is looking for .jshintrc and npm is looking for package.json ?

+55
config configuration mocha dotfiles
Apr 11 '13 at 14:10
source share
2 answers

Yes. You can create a ./test/mocha.opts file, and you can specify --no-colors in the file.

See mocha.opts in the Mocha Doc for details.

+60
Apr 11 '13 at 16:08
source share

The default is ./test/mocha.opts . You can pass a custom path with the --opts :

mocha --opts ./mocha.opts

Useful if you do not store your tests in the test/ folder, but, for example, next to the code files.

Any name and extension seems to work, so you can even make mocha --opts .mocharc if you want it to work well with .jshintrc , .babelrc , etc.

+30
Jun 13 '16 at 15:07
source share



All Articles