7.2.0 / 2020-05-22
:tada: Enhancements
:bug: Fixes
:book: Documentation
:nut_and_bolt: Other
7.1.2 / 2020-04-26
:nut_and_bolt: Other
:book: Documentation
7.1.1 / 2020-03-18
:lock: Security Fixes
- #4204: Update dependencies mkdirp, yargs-parser and yargs (@juergba)
:bug: Fixes
:book: Documentation
7.1.0 / 2020-02-26
:tada: Enhancements
#4038: Add Node.js native ESM support (@giltayar)
Mocha supports writing your test files as ES modules:
- Node.js only v12.11.0 and above
- Node.js below v13.2.0, you must set
--experimental-modules
option
- current limitations: please check our documentation
- for programmatic usage: see API: loadFilesAsync()
Note: Node.JS native ECMAScript Modules implementation has status: Stability: 1 - Experimental
:bug: Fixes
:book: Documentation
:nut_and_bolt: Other
7.0.1 / 2020-01-25
:bug: Fixes
- #4165: Fix exception when skipping tests programmatically (@juergba)
- #4153: Restore backwards compatibility for
reporterOptions
(@holm)
- #4150: Fix recovery of an open test upon uncaught exception (@juergba)
- #4147: Fix regression of leaking uncaught exception handler (@juergba)
:book: Documentation
:nut_and_bolt: Other
7.0.0 / 2020-01-05
:boom: Breaking Changes
- #3885: Drop Node.js v6.x support (@mojosoeun)
- #3890: Remove Node.js debug-related flags
--debug
/--debug-brk
and deprecate debug
argument (@juergba)
- #3962: Changes to command-line options (@ParkSB):
--list-interfaces
replaces --interfaces
--list-reporters
replaces --reporters
- Hook pattern of
this.skip()
(@juergba):
- #3859: When conditionally skipping in a
it
test, related afterEach
hooks are now executed
- #3741: When conditionally skipping in a
beforeEach
hook, subsequent inner beforeEach
hooks are now skipped and related afterEach
hooks are executed
- #4136: Disallow
this.skip()
within after
hooks
- #3967: Remove deprecated
getOptions()
and lib/cli/options.js
(@juergba)
- #4083: Uncaught exception in
pending
test: don't swallow, but retrospectively fail the test for correct exit code (@juergba)
- #4004: Align
Mocha
constructor's option names with command-line options (@juergba)
:tada: Enhancements
- #3980: Refactor and improve
--watch
mode with chokidar (@geigerzaehler):
- adds command-line options
--watch-files
and --watch-ignore
- removes
--watch-extensions
- #3979: Type "rs\n" to restart tests (@broofa)
:fax: Deprecations
These are soft-deprecated, and will emit a warning upon use. Support will be removed in (likely) the next major version of Mocha:
:bug: Fixes
:mag: Coverage
:book: Documentation
:nut_and_bolt: Other
6.2.3 / 2020-03-25
:lock: Security Fixes
6.2.2 / 2019-10-18
:bug: Fixes
:book: Documentation
6.2.1 / 2019-09-29
:bug: Fixes
- #3955: tty.getWindowSize is not a function inside a "worker_threads" worker (@1999)
- #3970: remove extraGlobals() (@juergba)
- #3984: Update yargs-unparser to v1.6.0 (@juergba)
- #3983: Package 'esm': spawn child-process for correct loading (@juergba)
- #3986: Update yargs to v13.3.0 and yargs-parser to v13.1.1 (@juergba)
:book: Documentation
6.2.0 / 2019-07-18
:tada: Enhancements
:bug: Fixes
:book: Documentation
:mag: Coverage
:nut_and_bolt: Other
6.1.4 / 2019-04-18
:lock: Security Fixes
6.1.3 / 2019-04-11
:bug: Fixes
6.1.2 / 2019-04-08
:bug: Fixes
- #3867: Re-publish v6.1.1 from POSIX OS to avoid dropped executable flags (@boneskull)
6.1.1 / 2019-04-07
:bug: Fixes
6.1.0 / 2019-04-07
:lock: Security Fixes
- #3845: Update dependency "js-yaml" to v3.13.0 per npm security advisory (@plroebuck)
:tada: Enhancements
- #3766: Make reporter constructor support optional
options
parameter (@plroebuck)
- #3760: Add support for config files with
.jsonc
extension (@sstephant)
:fax: Deprecations
These are soft-deprecated, and will emit a warning upon use. Support will be removed in (likely) the next major version of Mocha:
:bug: Fixes
- #3829: Use cwd-relative pathname to load config file (@plroebuck)
- #3745: Fix async calls of
this.skip()
in "before each" hooks (@juergba)
- #3669: Enable
--allow-uncaught
for uncaught exceptions thrown inside hooks (@givanse)
and some regressions:
:book: Documentation
:nut_and_bolt: Other
- #3830: Replace dependency "findup-sync" with "find-up" for faster startup (@cspotcode)
- #3799: Update devDependencies to fix many npm vulnerabilities (@XhmikosR)
6.0.2 / 2019-02-25
:bug: Fixes
Two more regressions fixed:
- #3768: Test file paths no longer dropped from
mocha.opts
(@boneskull)
- #3767:
--require
does not break on module names that look like certain node
flags (@boneskull)
6.0.1 / 2019-02-21
The obligatory round of post-major-release bugfixes.
:bug: Fixes
These issues were regressions.
- #3754: Mocha again finds
test.js
when run without arguments (@plroebuck)
- #3756: Mocha again supports third-party interfaces via
--ui
(@boneskull)
- #3755: Fix broken
--watch
(@boneskull)
- #3759: Fix unwelcome deprecation notice when Mocha run against languages (CoffeeScript) with implicit return statements; returning a non-
undefined
value from a describe
callback is no longer considered deprecated (@boneskull)
:book: Documentation
6.0.0 / 2019-02-18
:tada: Enhancements
:bug: Fixes
- #3737: Fix falsy values from options globals (@plroebuck)
- #3707: Fix encapsulation issues for
Suite#_onlyTests
and Suite#_onlySuites
(@vkarpov15)
- #3711: Fix diagnostic messages dealing with plurality and markup of output (@plroebuck)
- #3723: Fix "reporter-option" to allow comma-separated options (@boneskull)
- #3722: Fix code quality and performance of
lookupFiles
and files
(@plroebuck)
- #3650, #3654: Fix noisy error message when no files found (@craigtaub)
- #3632: Tests having an empty title are no longer confused with the "root" suite (@juergba)
- #3666: Fix missing error codes (@vkarpov15)
- #3684: Fix exiting problem in Node.js v11.7.0+ (@addaleax)
- #3691: Fix
--delay
(and other boolean options) not working in all cases (@boneskull)
- #3692: Fix invalid command-line argument usage not causing actual errors (@boneskull)
- #3698, #3699: Fix debug-related Node.js options not working in all cases (@boneskull)
- #3700: Growl notifications now show the correct number of tests run (@outsideris)
- #3686: Avoid potential ReDoS when diffing large objects (@cyjake)
- #3715: Fix incorrect order of emitted events when used programmatically (@boneskull)
- #3706: Fix regression wherein
--reporter-option
/--reporter-options
did not support comma-separated key/value pairs (@boneskull)
:book: Documentation
:nut_and_bolt: Other
6.0.0-1 / 2019-01-02
:bug: Fixes
- Fix missing
mocharc.json
in published package (@boneskull)
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!
:boom: Breaking Changes
- #3149: Drop Node.js v4.x support (@outsideris)
- #3556: Changes to command-line options (@boneskull):
--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
- #3275:
--watch-extensions
no longer implies js
; it must be explicitly added (@TheDancingCode)
- #2908:
tap
reporter emits error messages (@chrmod)
- #2819: When conditionally skipping in a
before
hook, subsequent before
hooks and tests in nested suites are now skipped (@bannmoore)
- #627: Emit filepath in "timeout exceeded" exceptions where applicable (@boneskull)
- #3556:
lib/template.html
has moved to lib/browser/template.html
(@boneskull)
- #2576: An exception is now thrown if Mocha fails to parse or find a
mocha.opts
at a user-specified path (@plroebuck)
- #3458: Instantiating a
Base
-extending reporter without a Runner
parameter will throw an exception (@craigtaub)
- #3125: For consumers of Mocha's programmatic API, all exceptions thrown from Mocha now have a
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)
:fax: Deprecations
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
instead
- Consumers of the function exported by
bin/options
should now use the loadMochaOpts
or loadOptions
(preferred) functions exported by the lib/cli/options
module
Regarding the Mocha
class constructor (from lib/mocha
):
- Use property
color: false
instead of useColors: false
- Use property
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
.
:tada: Enhancements
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
- Use
--config /path/to/rc/file
to specify an explicit path
- Use
--package /path/to/package.json
to specify an explicit package.json
to read the mocha
prop from
- Use
--no-config
or --no-package
to completely disable loading of configuration via RC file and package.json
, respectively
- Configurations are merged as applicable using the priority list:
- Command-line arguments
- RC file
package.json
mocha.opts
- Mocha's own defaults
- Check out these example config files
Node/V8 flag support in mocha
executable:
- Support all allowed
node
flags as supported by the running version of node
(also thanks to @demurgos)
- Support any V8 flag by prepending
--v8-
to the flag name
- All flags are also supported via config files,
package.json
properties, or mocha.opts
- Debug-related flags (e.g.,
--inspect
) now imply --no-timeouts
- Use of e.g.,
--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)
#3428: xunit
reporter shows diffs (@mlucool)
#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)
:bug: Fixes
:book: Documentation
:nut_and_bolt: Other
5.2.0 / 2018-05-18
:tada: Enhancements
:bug: Fixes
:book: Documentation
:nut_and_bolt: Other
5.1.1 / 2018-04-18
:bug: Fixes
5.1.0 / 2018-04-12
:tada: Enhancements
:bug: Fixes
:book: Documentation
:nut_and_bolt: Other
5.0.5 / 2018-03-22
Welcome @outsideris to the team!
:bug: Fixes
:book: Documentation
:nut_and_bolt: Other
5.0.4 / 2018-03-07
:bug: Fixes
- #3265: Fixes regression in "watch" functionality introduced in v5.0.2 (@outsideris)
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).
:lock: Security Fixes
:nut_and_bolt: Other
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!
:bug: Fixes
#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)
:nut_and_bolt: Other
5.0.1 / 2018-02-07
...your garden-variety patch release.
Special thanks to Wallaby.js for their continued support! :heart:
:bug: Fixes
:book: Documentation
:nut_and_bolt: Other
5.0.0 / 2018-01-17
Mocha starts off 2018 right by again dropping support for unmaintained rubbish.
Welcome @vkarpov15 to the team!
:boom: Breaking Changes
- #3148: Drop support for IE9 and IE10 (@Bamieh)
Practically speaking, only code which consumes (through bundling or otherwise) the userland buffer module should be affected. However, Mocha will no longer test against these browsers, nor apply fixes for them.
:tada: Enhancements
:bug: Fixes
:sunglasses: Developer Experience
:book: Documentation
:nut_and_bolt: Other