Changelog
6.0.0-0 / 2019-01-01
Documentation for this release can be found at next.mochajs.org!
Welcome @plroebuck, @craigtaub, & @markowsiak to the team!
--grep
and --fgrep
are now mutually exclusive; attempting to use both will cause Mocha to fail instead of simply ignoring --grep
--compilers
is no longer supported; attempting to use will cause Mocha to fail with a link to more information-d
is no longer an alias for --debug
; -d
is currently ignored--watch-extensions
no longer implies js
; it must be explicitly added (@TheDancingCode)tap
reporter emits error messages (@chrmod)before
hook, subsequent before
hooks and tests in nested suites are now skipped (@bannmoore)lib/template.html
has moved to lib/browser/template.html
(@boneskull)mocha.opts
at a user-specified path (@plroebuck)Base
-extending reporter without a Runner
parameter will throw an exception (@craigtaub)code
property (and some will have additional metadata). Some Error
messages have changed. Please use the code
property to check Error
types instead of the message
property; these descriptions will be localized in the future. (@craigtaub)These are soft-deprecated, and will emit a warning upon use. Support will be removed in (likely) the next major version of Mocha:
-gc
users should use --gc-global
insteadbin/options
should now use the loadMochaOpts
or loadOptions
(preferred) functions exported by the lib/cli/options
moduleRegarding the Mocha
class constructor (from lib/mocha
):
color: false
instead of useColors: false
timeout: false
instead of enableTimeouts: false
All of the above deprecations were introduced by #3556.
mocha.opts
is now considered "legacy"; please prefer RC file or package.json
over mocha.opts
.
Enhancements introduced in #3556:
Mocha now supports "RC" files in JS, JSON, YAML, or package.json
-based (using mocha
property) format
.mocharc.js
, .mocharc.json
, .mocharc.yaml
or .mocharc.yml
are valid "rc" file names and will be automatically loaded--config /path/to/rc/file
to specify an explicit path--package /path/to/package.json
to specify an explicit package.json
to read the mocha
prop from--no-config
or --no-package
to completely disable loading of configuration via RC file and package.json
, respectivelypackage.json
mocha.opts
Node/V8 flag support in mocha
executable:
node
flags as supported by the running version of node
(also thanks to @demurgos)--v8-
to the flag namepackage.json
properties, or mocha.opts
--inspect
) now imply --no-timeouts
--debug
will automatically invoke --inspect
if supported by running version of node
Support negation of any Mocha-specific command-line flag by prepending --no-
to the flag name
Interfaces now have descriptions when listed using --interfaces
flag
Mocha
constructor supports all options
--extension
is now an alias for --watch-extensions
and affects non-watch-mode test runs as well. For example, to run only test/*.coffee
(not test/*.js
), you can do mocha --require coffee-script/register --extensions coffee
.
#3552: tap
reporter is now TAP13-capable (@plroebuck & @mollstam)
#3535: Mocha's version can now be queried programmatically via public property Mocha.prototype.version
(@plroebuck)
#2529: Runner
now emits a retry
event when tests are retried (reporters can listen for this) (@catdad)
#2962, #3111: In-browser notification support; warn about missing prereqs when --growl
supplied (@plroebuck)
--no-timeouts
and --timeout 0
now does what you'd expect (@boneskull)--no-exit
option (@boneskull)SIGINT
(@boneskull)--forbid-only
and --forbid-pending
now "fail fast" when encountered on a suite (@outsideris)stdout:
prefix in browser console (@Bamieh)utils.isPromise()
(@fabiosantoscode)--bail
would not execute "after" nor "after each" hooks (@juergba)TERM=dumb
(@plroebuck).github/CONTRIBUTING.md
(@markowsiak)slow
option (@finfin)--watch
docs (@benglass)ms
userland module instead of hand-rolled solution (@gizemkeser)Changelog
5.2.0 / 2018-05-18
mocha.opts
(@plroebuck)before
hooks when using --bail
(@outsideris)Buffer.from()
(@harrysarson)Changelog
5.1.0 / 2018-04-12
Changelog
5.0.5 / 2018-03-22
Welcome @outsideris to the team!
--bail
failing to bail within hooks (@outsideris)describe.skip()
) (@outsideris)CHANGELOG.md
(@tagoro9, @honzajavorek)Changelog
5.0.4 / 2018-03-07
Changelog
5.0.3 / 2018-03-06
This patch features a fix to address a potential "low severity" ReDoS vulnerability in the diff package (a dependency of Mocha).
generateDiff()
in Base
reporter (@harrysarson)Changelog
5.0.2 / 2018-03-05
This release fixes a class of tests which report as false positives. Certain tests will now break, though they would have previously been reported as passing. Details below. Sorry for the inconvenience!
#3226: Do not swallow errors that are thrown asynchronously from passing tests (@boneskull). Example:
```js it('should actually fail, sorry!', function (done) { // passing assertion assert(true === true);
// test complete & is marked as passing done();
// ...but something evil lurks within setTimeout(() => { throw new Error('chaos!'); }, 100); }); ```
Previously to this version, Mocha would have silently swallowed the chaos!
exception, and you wouldn't know. Well, now you know. Mocha cannot recover from this gracefully, so it will exit with a nonzero code.
Maintainers of external reporters: If a test of this class is encountered, the Runner
instance will emit the end
event twice; you may need to change your reporter to use runner.once('end')
intead of runner.on('end')
.
#3093: Fix stack trace reformatting problem (@outsideris)
browser-stdout
to v1.3.1 (@honzajavorek)Changelog
5.0.1 / 2018-02-07
...your garden-variety patch release.
Special thanks to Wallaby.js for their continued support! :heart:
--delay
now works with .only()
(@silviom)--glob
docs (@outsideris)Changelog
5.0.0 / 2018-01-17
Mocha starts off 2018 right by again dropping support for unmaintained rubbish.
Welcome @vkarpov15 to the team!
--file
command line argument (documentation) (@hswolff)--no-timeouts
docs (@dfberry)done()
callback docs (@maraisr)README.md
organization (@xxczaki)