Skip to content

Commit ff6b64f

Browse files
Issue #1592 Improve documentation for mocha in browser.
You can specify a the constructor of your custom reporter in options and mocha will use it. Make references to a reporters' names more uniform.
1 parent ba96962 commit ff6b64f

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

docs/index.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,13 +1391,13 @@ The "nyan" reporter is exactly what you might expect:
13911391

13921392
### TAP
13931393

1394-
The TAP reporter emits lines for a [Test-Anything-Protocol][] consumer.
1394+
The "TAP" reporter emits lines for a [Test-Anything-Protocol][] consumer.
13951395

13961396
![test anything protocol](images/reporter-tap.png?withoutEnlargement&resize=920,9999){:class="screenshot" lazyload="on"}
13971397

13981398
### Landing Strip
13991399

1400-
The Landing Strip (`landing`) reporter is a gimmicky test reporter simulating a plane landing :) unicode ftw
1400+
The Landing Strip ("landing") reporter is a gimmicky test reporter simulating a plane landing :) unicode ftw
14011401

14021402
![landing strip plane reporter](images/reporter-landing.png?withoutEnlargement&resize=920,9999){:class="screenshot" lazyload="on"}
14031403
![landing strip with failure](images/reporter-landing-fail.png?withoutEnlargement&resize=920,9999){:class="screenshot" lazyload="on"}
@@ -1488,7 +1488,7 @@ example, here is the Connect [test output][connect-test-output].
14881488

14891489
### XUnit
14901490

1491-
The `xunit` reporter is also available. It outputs an XUnit-compatible XML document, often applicable in CI servers.
1491+
The "xunit" reporter is also available. It outputs an XUnit-compatible XML document, often applicable in CI servers.
14921492

14931493
By default, it will output to the console. To write directly to a file, use `--reporter-options output=filename.xml`.
14941494

@@ -1574,6 +1574,16 @@ mocha.setup({
15741574
});
15751575
```
15761576

1577+
Some available options:
1578+
1579+
```text
1580+
reporter {string|constructor} - Reporter** name or constructor.
1581+
ui {string} - Interface name.
1582+
useColors {boolean} - Use color TTY output from reporter?
1583+
```
1584+
1585+
\*\* Available built in reporters that can be referenced by name [here](#reporters), and recommended reporters for the browser [here](#reporting).
1586+
15771587
### Browser-specific Option(s)
15781588

15791589
The following option(s) _only_ function in a browser context:
@@ -1582,7 +1592,7 @@ The following option(s) _only_ function in a browser context:
15821592

15831593
### Reporting
15841594

1585-
The "HTML" reporter is what you see when running Mocha in the browser. It looks like this:
1595+
The "HTML" reporter is the default reporter when running Mocha in the browser. It looks like this:
15861596

15871597
![HTML test reporter](images/reporter-html.png?withoutEnlargement&resize=920,9999){:class="screenshot" lazyload="on"}
15881598

lib/mocha.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ exports.Test = require('./test');
7070
* @param {boolean} [options.asyncOnly] - Force `done` callback or promise?
7171
* @param {boolean} [options.bail] - Bail after first test failure?
7272
* @param {boolean} [options.checkLeaks] - Check for global variable leaks?
73-
* @param {boolean} [options.color] - Color TTY output from reporter?
7473
* @param {boolean} [options.delay] - Delay root suite execution?
7574
* @param {boolean} [options.diff] - Show diff on failure?
7675
* @param {string} [options.fgrep] - Test filter given string.
@@ -83,12 +82,13 @@ exports.Test = require('./test');
8382
* @param {boolean} [options.inlineDiffs] - Display inline diffs?
8483
* @param {boolean} [options.invert] - Invert test filter matches?
8584
* @param {boolean} [options.noHighlighting] - Disable syntax highlighting?
86-
* @param {string} [options.reporter] - Reporter name.
85+
* @param {string|constructor} [options.reporter] - Reporter name or constructor.
8786
* @param {Object} [options.reporterOption] - Reporter settings object.
8887
* @param {number} [options.retries] - Number of times to retry failed tests.
8988
* @param {number} [options.slow] - Slow threshold value.
9089
* @param {number|string} [options.timeout] - Timeout threshold value.
9190
* @param {string} [options.ui] - Interface name.
91+
* @param {boolean} [options.useColors] - Use color TTY output from reporter?
9292
*/
9393
function Mocha(options) {
9494
options = utils.assign({}, mocharc, options || {});

0 commit comments

Comments
 (0)