Skip to content

Commit

Permalink
docs(docs/index.md): Update "mocha.opts" documentation
Browse files Browse the repository at this point in the history
Added information on file content, noting support for comment/blank lines.
  • Loading branch information
plroebuck authored and boneskull committed May 18, 2018
1 parent 9d9e6c6 commit fae9af2
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1257,15 +1257,32 @@ The "HTML" reporter is what you see when running Mocha in the browser. It looks

## `mocha.opts`

Back on the server, Mocha will attempt to load `./test/mocha.opts` as a configuration file of sorts. The lines in this file are combined with any command-line arguments. The command-line arguments take precedence. For example, suppose you have the following `mocha.opts` file:
Back on the server, Mocha will attempt to load `"./test/mocha.opts"` as a
Run-Control file of sorts.

Beginning-of-line comment support is available; any line _starting_ with a
hash (#) symbol will be considered a comment. Blank lines may also be used.
Any other line will be treated as a command-line argument (along with any
associated option value) to be used as a default setting. Settings should be
specified one per line.

The lines in this file are prepended to any actual command-line arguments.
As such, actual command-line arguments will take precedence over the defaults.

For example, suppose you have the following `mocha.opts` file:

```sh
# mocha.opts

--require should
--reporter dot
--ui bdd
```

This will default the reporter to `dot`, require the `should` library, and use `bdd` as the interface. With this, you may then invoke `mocha` with additional arguments, here enabling [Growl](http://growl.info) support, and changing the reporter to `list`:
The settings above will default the reporter to `dot`, require the `should`
library, and use `bdd` as the interface. With this, you may then invoke `mocha`
with additional arguments, here enabling [Growl](http://growl.info/) support,
and changing the reporter to `list`:

```sh
$ mocha --reporter list --growl
Expand Down

0 comments on commit fae9af2

Please sign in to comment.