You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--watch, -w Watch files in the current working directory for changes
880
+
[boolean]
882
881
883
882
Test Filters
884
883
--fgrep, -f Only run tests containing this string [string]
@@ -1095,7 +1094,7 @@ Files having this extension will be considered test files. Defaults to `js`.
1095
1094
1096
1095
Affects `--watch` behavior.
1097
1096
1098
-
Specifying `--extension` will _remove_`.js` as a test file extension; use`--extension js` to re-add it. For example, to load `.mjs` and `.js` test files, you must supply `--extension mjs --extension js`.
1097
+
The option can be given multiple times. The option accepts a comma-delimited list:`--extension a,b` is equivalent to `--extension a --extension b`
1099
1098
1100
1099
### `--file <file|directory|glob>`
1101
1100
@@ -1107,6 +1106,8 @@ Files specified this way are not affected by `--sort` or `--recursive`.
1107
1106
1108
1107
Files specified in this way should contain one or more suites, tests or hooks. If this is not the case, consider `--require` instead.
When looking for test files, recurse into subdirectories.
@@ -1132,6 +1133,8 @@ Sort test files (by absolute path) using [Array.prototype.sort][mdn-array-sort].
1132
1133
1133
1134
### `--watch, -w`
1134
1135
1136
+
Rerun tests on file changes.
1137
+
1135
1138
Executes tests on changes to JavaScript in the current working directory (and once initially).
1136
1139
1137
1140
By default, only files with extension `.js` are watched. Use `--extension` to change this behavior.
@@ -1545,23 +1548,32 @@ mocha.setup({
1545
1548
ui:'tdd'
1546
1549
});
1547
1550
1548
-
// Use "tdd" interface, ignore leaks, and force all tests to be asynchronous
1551
+
// Use "tdd" interface, check global leaks, and force all tests to be asynchronous
1549
1552
mocha.setup({
1550
1553
ui:'tdd',
1551
-
ignoreLeaks:true,
1554
+
checkLeaks:true,
1552
1555
asyncOnly:true
1553
1556
});
1554
1557
```
1555
1558
1556
1559
### Browser-specific Option(s)
1557
1560
1558
-
The following option(s) _only_ function in a browser context:
1561
+
Browser Mocha supports many, but not all [cli options](#command-line-usage).
1562
+
To use a [cli option](#command-line-usage) that contains a "-", please convert the option to camel-case, (eg. `check-leaks` to `checkLeaks`).
1563
+
1564
+
#### Options that differ slightly from [cli options](#command-line-usage):
1565
+
1566
+
`reporter`_{string|constructor}_
1567
+
You can pass a reporter's name or a custom reporter's constructor. You can find **recommended** reporters for the browser [here](#reporting). It is possible to use [built-in reporters](#reporters) as well. Their employment in browsers is neither recommended nor supported, open the console to see the test results.
1568
+
1569
+
#### Options that _only_ function in browser context:
1559
1570
1560
-
`noHighlighting`: If set to `true`, do not attempt to use syntax highlighting on output test code.
1571
+
`noHighlighting`_{boolean}_
1572
+
If set to `true`, do not attempt to use syntax highlighting on output test code.
1561
1573
1562
1574
### Reporting
1563
1575
1564
-
The "HTML" reporter is what you see when running Mocha in the browser. It looks like this:
1576
+
The "html" reporter is the default reporter when running Mocha in the browser. It looks like this:
1565
1577
1566
1578
{:class="screenshot" lazyload="on"}
0 commit comments