Is there a .mocha file where I can specify defaults such as --no-colors?
Solution 1:
Yes. You can create a file ./test/mocha.opts
and in the file you can specify --no-colors
.
See mocha.opts on Mocha Doc for more information.
Solution 2:
The default is ./test/mocha.opts
. You can pass a custom path with the --opts
parameter :
mocha --opts ./mocha.opts
Useful in case you don’t store your tests in test/
folder, but next to code files, for example.
Any name and extension seems to work, so you can even do mocha --opts .mocharc
if you want it to go well with .jshintrc
, .babelrc
and the like.