docs/changelogs/CHANGELOG_V3_older.md
xit export for "require" interface (@solodynamo)--compilers coverage (@ScottFreeCode)--forbid-only and --forbid-pending flags. Use these in CI or hooks to ensure tests aren't accidentally being skipped! (@charlierudolph)--napi-modules flag (@jupp0r)os.tmpDir (@makepanic)process.exitCode (@chrisleck)Fixed a publishing mishap with git's autocrlf settings.
Mocha is now moving to a quicker release schedule: when non-breaking changes are merged, a release should happen that week.
This week's highlights:
allowUncaught added to commandline as --allow-uncaught (and bugfixed)--no-warnings and --trace-warnings flags (@sonicdoe)Thanks to all our contributors, maintainers, sponsors, and users! ❤️
As highlights:
--inspect-brk on command-line (@igwejk)semistandard directly (@kt3k)Mocha is proud to have joined the JS Foundation. For more information, read the announcement.
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.
Mocha remains licensed under the MIT license.
--watch encounters broken symlinks (@villesau)list reporter (@Aldaviva)--inspect flag to CLI help (@ughitsaaron)README.md (@boneskull, @ScottFreeCode, @dasilvacontin)Thanks to all our contributors, sponsors and backers! Keep on the lookout for a public roadmap and new contribution guide coming soon.
Error's stack property isn't writable (@boneskull)done() was called multiple times when it wasn't (@frankleonrose).js files (@boneskull)--inspect on command-line (@simov)this.skip() is called (@boneskull)SIGINT encountered; exit code can no longer rollover at 256 (@Munter)only()/skip() in IE7/IE8 (@boneskull)String constructor (more) (@boneskull)describe.only() suites (@not-an-aardvark)json-cov and html-cov reporters in CLI (@boneskull)describe.only() suites (@not-an-aardvark):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:
```js const assert = require('assert');
it('should complete this test', function (done) { return new Promise(function (resolve) { assert.ok(true); resolve(); }) .then(done); }); ```
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 than 2147483648 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.
Mocha no longer supports component.
The long-forsaken HTMLCov and JSONCov reporters--and any relationship to the "node-jscoverage" project--have been removed.
spec reporter now omits leading carriage returns (\r) in non-TTY environment.
--grep and browser's grep querystring; enables flags such as i for case-insensitive matches and u for unicode. (@a8m)dot reporter; , will denote a "pending" test and ! will denote a "failing" test. (@elliottcable).only() behavior. (@a8m)this.skip() in async tests and hooks. (@boneskull)--preserve-symlinks. (@rosswarren)Date.prototype.toISOString(), JSON, or has a non-standard implementation of JSON. (@ndhoule, @boneskull)after() failing to execute if test skipped using this.skip() in beforeEach(); no longer marks the entire suite as "pending". (@dasilvacontin, @boneskull)markdown and html (browser) reporters. (@ScottFreeCode)html (browser) reporter. (@AviVahl)doc reporter crashing when test fails. (@jleyba)browser-entry.js) is published to npm (for use with bundlers). (@boneskull)this.slow() without a value would blast any previously set value. (@boneskull)--help on CLI. (@ScottFreeCode)this.timeout() with very large values (@callumacrae, @boneskull)glob, commander, escape-string-regexp, and supports-color. (@boneskull, @RobLoach)engines field in package.json. (@shinnn, @boneskull)We :heart: our backers and sponsors!
:shipit:
6d24063)9e93efc)49b5ff1)bd9450b)Thanks @entertainyou, @SimenB, @just-paja for the heads-up.
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).
We now run unit tests against PhantomJS v1.x and an assortment of browsers on SauceLabs, including:
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.
Node.js 6.x "just worked" before, but now it's in the CI matrix, so it's "officially" supported. Mocha still retains support for Node.js 0.8.x.
You'll see mostly bug fixes below, but also a couple features--as such, it's a "minor" release.
Thanks to everyone who contributed, and our fabulous sponsors and backers!
c04c1d7, 0b1e9b3, 0dde0fa, f8a3d86, 9e8cbaa)524862b)7920fc4)4301caa)61fbb7f)mocha.css collisions (@irnc via 0543798)this.skip() in HTML reporter (@mislav via cb4248b)e290bc0)util.stringify() (@ryym via ea61d05)Object.prototype.hasOwnProperty (@mantoni via b20fdfe)9c41051)9ae6a85)8031f20, @ScottFreeCode via f83b1d9)00d6469)caee94f)00fd0e1)README.md header (@dasilvacontin via c0f9be2)ba5637d)3904da4)progress and landing reporters (@gyandeeps)this.skip from spec with HTML reporter (@mislav)__proto__ (@ndhoule)version property from bower.json (@kkirsche)HISTORY.md (@rstacruz)ReferenceError "location is not defined" (@jakemmarsh)--allow-natives-syntax flag to node.pending field for json reporterf0facd2--no-exit to prevent process.exit() (#1018)Mocha.process hack for phantomjsclean utility methodsuite.skip()this.timeout(0)glob modulemocha init tests.html to index.htmlprocess global leak in the browsersetImmediate support for 0.10.xMocha#bail() method--async-only support to prevent false positives for missing done()this.timeout(ms) as Suite#timeout(ms). Closes #599this.timeout("5s") supporterr.showDiff is present.length checks to checkGlobals() before performing the filterms() to .slow() and .timeout()Mocha#checkLeaks() to re-enable global leak checksthis.slow() option [aheckmann].checkGlobals() solution [guille]fn.call() from reduce utilfn.call() from filter utilMocha#globals() calls, and stringsmocha.reporter() constructor support [jfirebaugh]mocha.timeout()Markdown exportMocha#grep(), escape regexp stringsdevicePixelRatio is not defined. Closes #549mocha init. Closes #539.only(). Closes #524.skip(). Closes #524xit() and xdescribe() [Brian Moore]Runner#uncaught(). Closes #494-E, --growl-errors to growl on failures onlyMocha#invert() to js apimake tmHTML reporter--trace-* option support--reporter MODULE--invert switch to invert --grep matchesNyan reporter. Closes #495HTML suite titles. Closes #486done() called multiple times with an error test--grep - regexp escape the inputthis.test.error(err) support to after each hooks. Closes #287js code block format error in markdown reporterpath.existsSync--growl from test/mocha.opts. Closes #289nyan reporter [Atsuya Takagi]mocha init <path> to copy client filesmocha(1) arg for directories to walk--recursive [tricknotes]context for BDD [hokaccha].timeout() in hooksmocha.run() in client version--watch. Closes #345location as a global on the CS. Closes #311markdown reporter (github flavour)--watch [Jakub Nešetřil]mocha.run([reporter]) as argument--watch: purge require cache. Closes #266HTMLCov reporterJSONCov reporter [kunklejr]xdescribe() and xit() to the BDD interface. Closes #263 (docs * Changed: make json reporter output pretty json--debug for debug to match node. Closes #247npm docs mocha support [TooTallNate]Context object used for hook and test-case this. Closes #253Suite#clone() .ctx reference. Closes #262--watch support. Closes #242--require files relative to the CWD. Closes #241done() after timeout error reporting [Phil Sung]--no-colors option [Jussi Virtanen]-b, --bail to exit on first exception [guillermo]-gc / --expose-gc [TooTallNate]qunit-inspired interface--watch all .js in the CWD. Closes #139self.test reference in runner. Closes #189XUnit reporter [FeeFighters/visionmedia]say(1) notification support [Maciej Małecki]err.stack, defaulting to message. Closes #180make tm mkdir -p the dest. Closes #137-d for --debug supportmocha-debug(1), use mocha --debugthis.timeout(0). Closes #134require() leak spotted by [guillermo]window.onerror [guillermo]mocha.css to PHONY list.mocha.js to PHONY list.done() to be called with non-Errormocha.run(). Closes #126err.message is not present-w, --watch. Closes #72--ignore-leaks to ignore global leak checking?grep=pattern support--globals <names> to specify accepted globals. Closes #99mocha-debug(1) on some systems. Closes #232runner.total--globals <names> to specify accepted globals. Closes #99mocha-debug(1). Closes #232suiteSetup and suiteTeardown to TDD interface [David Henderson]Runner#total for accurate reportingHookRunnableTest is Runnable--interfaces--reporters-c, --colors. Closes #69-C, --no-colors to explicitly disable--timeout second shorthand support, ex --timeout 3s.make mocha.css target. Closes #45doc reporter. Closes #33make tm. Closes #20-s, --slow <ms> to specify "slow" test thresholdmocha-debug(1)mocha.opts support. Closes #31done(). Closes #35