5 The following changes are required if you are upgrading from the previous version:
8 - Refresh `node_modules` folder for updated dependencies.
9 - **Plugin Developers:**
11 - **Core Contributors:**
12 - Refresh `node_modules` folder for updated dependencies.
16 This is a small patch that updates the dependency tree so browserify users can install
17 chai. (Remove conditional requires)
21 The following changes are required if you are upgrading from the previous version:
24 - See `deep.equal` notes.
25 - **Plugin Developers:**
27 - **Core Contributors:**
28 - Refresh `node_modules` folder for updated dependencies.
32 This version of Chai focused on a overhaul to the deep equal utility. The code for this
33 tool has been removed from the core lib and can now be found at:
34 [chai / deep-eql](https://github.com/chaijs/deep-eql). As stated in previous releases,
35 this is part of a larger initiative to provide transparency, independent testing, and coverage for
36 some of the more complicated internal tools.
38 For the most part `.deep.equal` will behave the same as it has. However, in order to provide a
39 consistent ruleset across all types being tested, the following changes have been made and _might_
40 require changes to your tests.
42 **1.** Strict equality for non-traversable nodes according to [egal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
44 _Previously:_ Non-traversable equal via `===`.
47 expect(NaN).to.deep.equal(NaN);
48 expect(-0).to.not.deep.equal(+0);
51 **2.** Arguments are not Arrays (and all types must be equal):
53 _Previously:_ Some crazy nonsense that led to empty arrays deep equaling empty objects deep equaling dates.
56 expect(arguments).to.not.deep.equal([]);
57 expect(Array.prototype.slice.call(arguments)).to.deep.equal([]);
60 - [#156](https://github.com/chaijs/chai/issues/156) Empty object is eql to empty array
61 - [#192](https://github.com/chaijs/chai/issues/192) empty object is eql to a Date object
62 - [#194](https://github.com/chaijs/chai/issues/194) refactor deep-equal utility
64 ### CI and Browser Testing
66 Chai now runs the browser CI suite using [Karma](http://karma-runner.github.io/) directed at
67 [SauceLabs](https://saucelabs.com/). This means we get to know where our browser support stands...
68 and we get a cool badge:
70 [![Selenium Test Status](https://saucelabs.com/browser-matrix/logicalparadox.svg)](https://saucelabs.com/u/logicalparadox)
72 Look for the list of browsers/versions to expand over the coming releases.
74 - [#195](https://github.com/chaijs/chai/issues/195) karma test framework
78 The following changes are required if you are upgrading from the previous version:
81 - No changes required.
82 - **Plugin Developers:**
84 - **Core Contributors:**
85 - Refresh `node_modules` folder for updated dependencies.
87 ### Coverage Reporting
89 Coverage reporting has always been available for core-developers but the data has never been published
90 for our end users. In our ongoing effort to improve accountability this data will now be published via
91 the [coveralls.io](https://coveralls.io/) service. A badge has been added to the README and the full report
92 can be viewed online at the [chai coveralls project](https://coveralls.io/r/chaijs/chai). Furthermore, PRs
93 will receive automated messages indicating how their PR impacts test coverage. This service is tied to TravisCI.
97 - [#175](https://github.com/chaijs/chai/issues/175) Add `bower.json`. (Fix ignore all)
101 The following changes are required if you are upgrading from the previous version:
104 - No changes required.
105 - **Plugin Developers:**
106 - No changes required
107 - **Core Contributors:**
108 - Refresh `node_modules` folder for updated dependencies.
110 ### Official Bower Support
112 Support has been added for the Bower Package Manager ([bower.io])(http://bower.io/). Though
113 Chai could be installed via Bower in the past, this update adds official support via the `bower.json`
116 - [#175](https://github.com/chaijs/chai/issues/175) Add `bower.json`.
118 ## 1.7.0 / 2013-06-17
120 The following changes are required if you are upgrading from the previous version:
123 - No changes required.
124 - **Plugin Developers:**
125 - Review AssertionError update notice.
126 - **Core Contributors:**
127 - Refresh `node_modules` folder for updated dependencies.
129 ### AssertionError Update Notice
131 Chai now uses [chaijs/assertion-error](https://github.com/chaijs/assertion-error) instead an internal
132 constructor. This will allow for further iteration/experimentation of the AssertionError constructor
133 independant of Chai. Future plans include stack parsing for callsite support.
135 This update constructor has a different constructor param signature that conforms more with the standard
136 `Error` object. If your plugin throws and `AssertionError` directly you will need to update your plugin
137 with the new signature.
140 var AssertionError = require('chai').AssertionError;
145 * @param {Object} options
148 throw new AssertionError({
149 message: 'An assertion error occurred'
152 , startStackFunction: arguments.callee
159 * @param {String} message
160 * @param {Object} options
161 * @param {Function} start stack function
164 throw new AssertionError('An assertion error occurred', {
168 }, arguments.callee);
171 throw new AssertionError('An assertion error occurred');
172 throw new AssertionError('An assertion error occurred', null, arguments.callee);
175 #### External Dependencies
177 This is the first non-developement dependency for Chai. As Chai continues to evolve we will begin adding
178 more; the next will likely be improved type detection and deep equality. With Chai's userbase continually growing
179 there is an higher need for accountability and documentation. External dependencies will allow us to iterate and
180 test on features independent from our interfaces.
182 Note: The browser packaged version `chai.js` will ALWAYS contain all dependencies needed to run Chai.
184 ### Community Contributions
186 - [#169](https://github.com/chaijs/chai/pull/169) Fix deep equal comparison for Date/Regexp types. [@katsgeorgeek](https://github.com/katsgeorgeek)
187 - [#171](https://github.com/chaijs/chai/pull/171) Add `assert.notOk()`. [@Bartvds](https://github.com/Bartvds)
188 - [#173](https://github.com/chaijs/chai/pull/173) Fix `inspect` utility. [@domenic](https://github.com/domenic)
190 Thank you to all who took the time to contribute!
192 ## 1.6.1 / 2013-06-05
194 The following changes are required if you are upgrading from the previous version:
197 - No changes required.
198 - **Plugin Developers:**
199 - No changes required.
200 - **Core Contributors:**
201 - Refresh `node_modules` folder for updated developement dependencies.
205 Regular Expressions are now tested as part of all deep equality assertions. In previous versions
206 they silently passed for all scenarios. Thanks to [@katsgeorgeek](https://github.com/katsgeorgeek) for the contribution.
208 ### Community Contributions
210 - [#161](https://github.com/chaijs/chai/pull/161) Fix documented name for assert interface's isDefined method. [@brandonpayton](https://github.com/brandonpayton)
211 - [#168](https://github.com/chaijs/chai/pull/168) Fix comparison equality of two regexps for when using deep equality. [@katsgeorgeek](https://github.com/katsgeorgeek)
213 Thank you to all who took the time to contribute!
217 - Mocha has been locked at version `1.8.x` to ensure `mocha-phantomjs` compatibility.
219 ## 1.6.0 / 2013-04-29
221 The following changes are required if you are upgrading from the previous version:
224 - No changes required.
225 - **Plugin Developers:**
226 - No changes required.
227 - **Core Contributors:**
228 - Refresh `node_modules` folder for updated developement dependencies.
232 #### Array Members Inclusion
234 Asserts that the target is a superset of `set`, or that the target and `set` have the same members.
235 Order is not taken into account. Thanks to [@NickHeiner](https://github.com/NickHeiner) for the contribution.
238 // (expect/should) full set
239 expect([4, 2]).to.have.members([2, 4]);
240 expect([5, 2]).to.not.have.members([5, 2, 1]);
242 // (expect/should) inclusion
243 expect([1, 2, 3]).to.include.members([3, 2]);
244 expect([1, 2, 3]).to.not.include.members([3, 2, 8]);
247 assert.sameMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'same members');
249 // (assert) inclusion
250 assert.includeMembers([ 1, 2, 3 ], [ 2, 1 ], 'include members');
254 #### Non-inclusion for Assert Interface
256 Most `assert` functions have a negative version, like `instanceOf()` has a corresponding `notInstaceOf()`.
257 However `include()` did not have a corresponding `notInclude()`. This has been added.
260 assert.notInclude([ 1, 2, 3 ], 8);
261 assert.notInclude('foobar', 'baz');
264 ### Community Contributions
266 - [#140](https://github.com/chaijs/chai/pull/140) Restore `call`/`apply` methods for plugin interface. [@RubenVerborgh](https://github.com/RubenVerborgh)
267 - [#148](https://github.com/chaijs/chai/issues/148)/[#153](https://github.com/chaijs/chai/pull/153) Add `members` and `include.members` assertions. [#NickHeiner](https://github.com/NickHeiner)
269 Thank you to all who took time to contribute!
273 - [#142](https://github.com/chaijs/chai/issues/142) `assert#include` will no longer silently pass on wrong-type haystack.
274 - [#158](https://github.com/chaijs/chai/issues/158) `assert#notInclude` has been added.
275 - Travis-CI now tests Node.js `v0.10.x`. Support for `v0.6.x` has been removed. `v0.8.x` is still tested as before.
277 ## 1.5.0 / 2013-02-03
279 ### Migration Requirements
281 The following changes are required if you are upgrading from the previous version:
284 - _Update [2013-02-04]:_ Some users may notice a small subset of deep equality assertions will no longer pass. This is the result of
285 [#120](https://github.com/chaijs/chai/issues/120), an improvement to our deep equality algorithm. Users will need to revise their assertions
286 to be more granular should this occur. Further information: [#139](https://github.com/chaijs/chai/issues/139).
287 - **Plugin Developers:**
288 - No changes required.
289 - **Core Contributors:**
290 - Refresh `node_modules` folder for updated developement dependencies.
292 ### Community Contributions
294 - [#126](https://github.com/chaijs/chai/pull/126): Add `eqls` alias for `eql`. [@RubenVerborgh](https://github.com/RubenVerborgh)
295 - [#127](https://github.com/chaijs/chai/issues/127): Performance refactor for chainable methods. [@RubenVerborgh](https://github.com/RubenVerborgh)
296 - [#133](https://github.com/chaijs/chai/pull/133): Assertion `.throw` support for primitives. [@RubenVerborgh](https://github.com/RubenVerborgh)
297 - [#137](https://github.com/chaijs/chai/issues/137): Assertion `.throw` support for empty messages. [@timnew](https://github.com/timnew)
298 - [#136](https://github.com/chaijs/chai/pull/136): Fix backward negation messages when using `.above()` and `.below()`. [@whatthejeff](https://github.com/whatthejeff)
300 Thank you to all who took time to contribute!
304 - Improve type detection of `.a()`/`.an()` to work in cross-browser scenarios.
305 - [#116](https://github.com/chaijs/chai/issues/116): `.throw()` has cleaner display of errors when WebKit browsers.
306 - [#120](https://github.com/chaijs/chai/issues/120): `.eql()` now works to compare dom nodes in browsers.
313 **1. Component Support:** Chai now included the proper configuration to be installed as a
314 [component](https://github.com/component/component). Component users are encouraged to consult
315 [chaijs.com](http://chaijs.com) for the latest version number as using the master branch
316 does not gaurantee stability.
319 // relevant component.json
321 "chaijs/chai": "1.5.0"
325 Alternatively, bleeding-edge is available:
327 $ component install chaijs/chai
329 **2. Configurable showDiff:** Some test runners (such as [mocha](http://visionmedia.github.com/mocha/))
330 include support for showing the diff of strings and objects when an equality error occurs. Chai has
331 already included support for this, however some users may not prefer this display behavior. To revert to
332 no diff display, the following configuration is available:
335 chai.Assertion.showDiff = false; // diff output disabled
336 chai.Assertion.showDiff = true; // default, diff output enabled
339 #### For Plugin Developers
341 **1. New Utility - type**: The new utility `.type()` is available as a better implementation of `typeof`
342 that can be used cross-browser. It handles the inconsistencies of Array, `null`, and `undefined` detection.
344 - **@param** _{Mixed}_ object to detect type of
345 - **@return** _{String}_ object type
348 chai.use(function (c, utils) {
350 utils.type({}); // 'object'
351 utils.type(null); // `null'
352 utils.type(undefined); // `undefined`
353 utils.type([]); // `array`
357 #### For Core Contributors
359 **1. Browser Testing**: Browser testing of the `./chai.js` file is now available in the command line
360 via PhantomJS. `make test` and Travis-CI will now also rebuild and test `./chai.js`. Consequently, all
361 pull requests will now be browser tested in this way.
363 _Note: Contributors opening pull requests should still NOT include the browser build._
365 **2. SauceLabs Testing**: Early SauceLab support has been enabled with the file `./support/mocha-cloud.js`.
366 Those interested in trying it out should create a free [Open Sauce](https://saucelabs.com/signup/plan) account
367 and include their credentials in `./test/auth/sauce.json`.