mocha

All 134 versions

: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.

Default Behavior

#2879: By default, Mocha will no longer force the process to exit once all tests complete. This means any test code (or code under test) which would normally prevent node from exiting will do so when run in Mocha. Supply the --exit flag to revert to pre-v4.0.0 behavior ([@ScottFreeCode], [@boneskull])

:newspaper: News

Mocha is now a JS Foundation Project!

Contributor License Agreement

Under the foundation, all contributors to Mocha must sign the JS Foundation CLA before their code can be merged. When sending a PR--if you have not already signed the CLA--a friendly bot will ask you to do so.

:boom: Breaking Changes

:warning: Due to the increasing difficulty of applying security patches made within its dependency tree, as well as looming incompatibilities with Node.js v7.0, Mocha no longer supports Node.js v0.8.

:warning: Mocha may no longer be installed by versions of npm less than 1.4.0. Previously, this requirement only affected Mocha's development dependencies. In short, this allows Mocha to depend on packages which have dependencies fixed to major versions (^).

.only() is no longer "fuzzy", can be used multiple times, and generally just works like you think it should. :joy:

To avoid common bugs, when a test injects a callback function (suggesting asynchronous execution), calls it, and returns a Promise, Mocha will now throw an exception:

The above test will fail with Error: Resolution method is overspecified. Specify a callback *or* return a Promise; not both..

When a test timeout value greater than2147483648 is specified in any context (--timeout, mocha.setup(), per-suite, per-test, etc.), the timeout will be disabled and the test(s) will be allowed to run indefinitely. This is equivalent to specifying a timeout value of 0. See MDN for reasoning.

The dot reporter now uses more visually distinctive characters when indicating "pending" and "failed" tests.

This has been awhile coming! We needed to feel confident that the next release wouldn't break browser compatibility (e.g. the last few patch releases).

Browser Tests in CI

We now run unit tests against PhantomJS v1.x and an assortment of browsers on SauceLabs, including:

Internet Explorer v8.0

Chrome (latest)

Firefox (latest)

Safari (latest)

Microsoft Edge (latest)

To accomplish this, we now run Mocha's unit tests (and a handful of integration tests) via Karma and a modified karma-mocha. Along the way, we had to solve issue [#880] (apologies to @mderijcke and @sukima who had PRs addressing this), as well as replace most usages of should with expect.js for IE8.

Going forward, when sending PRs, your code will only run against PhantomJS v1.x (and not hit SauceLabs) because security.