OLD | NEW |
| (Empty) |
1 # Release Notes | |
2 | |
3 ## 1.9.1 / 2014-03-19 | |
4 | |
5 The following changes are required if you are upgrading from the previous versio
n: | |
6 | |
7 - **Users:** | |
8 - Migrate configuration options to new interface. (see notes) | |
9 - **Plugin Developers:** | |
10 - No changes required | |
11 - **Core Contributors:** | |
12 - Refresh `node_modules` folder for updated dependencies. | |
13 | |
14 ### Configuration | |
15 | |
16 There have been requests for changes and additions to the configuration mechanis
ms | |
17 and their impact in the Chai architecture. As such, we have decoupled the | |
18 configuration from the `Assertion` constructor. This not only allows for central
ized | |
19 configuration, but will allow us to shift the responsibility from the `Assertion
` | |
20 constructor to the `assert` interface in future releases. | |
21 | |
22 These changes have been implemented in a non-breaking way, but a depretiation | |
23 warning will be presented to users until they migrate. The old config method wil
l | |
24 be removed in either `v1.11.0` or `v2.0.0`, whichever comes first. | |
25 | |
26 #### Quick Migration | |
27 | |
28 ```js | |
29 // change this: | |
30 chai.Assertion.includeStack = true; | |
31 chai.Assertion.showDiff = false; | |
32 | |
33 // ... to this: | |
34 chai.config.includeStack = true; | |
35 chai.config.showDiff = false; | |
36 ``` | |
37 | |
38 #### All Config Options | |
39 | |
40 ##### config.includeStack | |
41 | |
42 - **@param** _{Boolean}_ | |
43 - **@default** `false` | |
44 | |
45 User configurable property, influences whether stack trace is included in | |
46 Assertion error message. Default of `false` suppresses stack trace in the error | |
47 message. | |
48 | |
49 ##### config.showDiff | |
50 | |
51 - **@param** _{Boolean}_ | |
52 - **@default** `true` | |
53 | |
54 User configurable property, influences whether or not the `showDiff` flag | |
55 should be included in the thrown AssertionErrors. `false` will always be `false`
; | |
56 `true` will be true when the assertion has requested a diff be shown. | |
57 | |
58 ##### config.truncateThreshold **(NEW)** | |
59 | |
60 - **@param** _{Number}_ | |
61 - **@default** `40` | |
62 | |
63 User configurable property, sets length threshold for actual and expected values
| |
64 in assertion errors. If this threshold is exceeded, the value is truncated. | |
65 | |
66 Set it to zero if you want to disable truncating altogether. | |
67 | |
68 ```js | |
69 chai.config.truncateThreshold = 0; // disable truncating | |
70 ``` | |
71 | |
72 ### Community Contributions | |
73 | |
74 - [#228](https://github.com/chaijs/chai/pull/228) Deep equality check for memebe
rs. [@duncanbeevers](https://github.com/duncanbeevers) | |
75 - [#247](https://github.com/chaijs/chai/pull/247) Proofreading. [@didorellano](h
ttps://github.com/didoarellano) | |
76 - [#244](https://github.com/chaijs/chai/pull/244) Fix `contain`/`include` 1.9.0
regression. [@leider](https://github.com/leider) | |
77 - [#233](https://github.com/chaijs/chai/pull/233) Improvements to `ssfi` for `as
sert` interface. [@refack](https://github.com/refack) | |
78 - [#251](https://github.com/chaijs/chai/pull/251) New config option: object disp
lay threshold. [@romario333](https://github.com/romario333) | |
79 | |
80 Thank you to all who took time to contribute! | |
81 | |
82 ### Other Bug Fixes | |
83 | |
84 - [#183](https://github.com/chaijs/chai/issues/183) Allow `undefined` for actual
. (internal api) | |
85 - Update Karam(+plugins)/Istanbul to most recent versions. | |
86 | |
87 ## 1.9.0 / 2014-01-29 | |
88 | |
89 The following changes are required if you are upgrading from the previous versio
n: | |
90 | |
91 - **Users:** | |
92 - No changes required | |
93 - **Plugin Developers:** | |
94 - Review [#219](https://github.com/chaijs/chai/pull/219). | |
95 - **Core Contributors:** | |
96 - Refresh `node_modules` folder for updated dependencies. | |
97 | |
98 ### Community Contributions | |
99 | |
100 - [#202](https://github.com/chaijs/chai/pull/201) Improve error message for .thr
ow(). [@andreineculau](https://github.com/andreineculau) | |
101 - [#217](https://github.com/chaijs/chai/pull/217) Chai tests can be run with `--
watch`. [@demands](https://github.com/demands) | |
102 - [#219](https://github.com/chaijs/chai/pull/219) Add overwriteChainableMethod u
tility. [@demands](https://github.com/demands) | |
103 - [#224](https://github.com/chaijs/chai/pull/224) Return error on throw method t
o chain on error properties. [@vbardales](https://github.com/vbardales) | |
104 - [#226](https://github.com/chaijs/chai/pull/226) Add `has` to language chains.
[@duncanbeevers](https://github.com/duncanbeevers) | |
105 - [#230](https://github.com/chaijs/chai/pull/230) Support `{a:1,b:2}.should.incl
ude({a:1})` [@jkroso](https://github.com/jkroso) | |
106 - [#231](https://github.com/chaijs/chai/pull/231) Update Copyright notices to 20
14 [@duncanbeevers](https://github.com/duncanbeevers) | |
107 - [#232](https://github.com/chaijs/chai/pull/232) Avoid error instantiation if p
ossible on assert.throws. [@laconbass](https://github.com/laconbass) | |
108 | |
109 Thank you to all who took time to contribute! | |
110 | |
111 ### Other Bug Fixes | |
112 | |
113 - [#225](https://github.com/chaijs/chai/pull/225) Improved AMD wrapper provided
by upstream `component(1)`. | |
114 - [#185](https://github.com/chaijs/chai/issues/185) `assert.throws()` returns th
rown error for further assertions. | |
115 - [#237](https://github.com/chaijs/chai/pull/237) Remove coveralls/jscoverage, i
nclude istanbul coverage report in travis test. | |
116 - Update Karma and Sauce runner versions for consistent CI results. No more karm
a@canary. | |
117 | |
118 ## 1.8.1 / 2013-10-10 | |
119 | |
120 The following changes are required if you are upgrading from the previous versio
n: | |
121 | |
122 - **Users:** | |
123 - Refresh `node_modules` folder for updated dependencies. | |
124 - **Plugin Developers:** | |
125 - No changes required | |
126 - **Core Contributors:** | |
127 - Refresh `node_modules` folder for updated dependencies. | |
128 | |
129 ### Browserify | |
130 | |
131 This is a small patch that updates the dependency tree so browserify users can i
nstall | |
132 chai. (Remove conditional requires) | |
133 | |
134 ## 1.8.0 / 2013-09-18 | |
135 | |
136 The following changes are required if you are upgrading from the previous versio
n: | |
137 | |
138 - **Users:** | |
139 - See `deep.equal` notes. | |
140 - **Plugin Developers:** | |
141 - No changes required | |
142 - **Core Contributors:** | |
143 - Refresh `node_modules` folder for updated dependencies. | |
144 | |
145 ### Deep Equals | |
146 | |
147 This version of Chai focused on a overhaul to the deep equal utility. The code f
or this | |
148 tool has been removed from the core lib and can now be found at: | |
149 [chai / deep-eql](https://github.com/chaijs/deep-eql). As stated in previous rel
eases, | |
150 this is part of a larger initiative to provide transparency, independent testing
, and coverage for | |
151 some of the more complicated internal tools. | |
152 | |
153 For the most part `.deep.equal` will behave the same as it has. However, in orde
r to provide a | |
154 consistent ruleset across all types being tested, the following changes have bee
n made and _might_ | |
155 require changes to your tests. | |
156 | |
157 **1.** Strict equality for non-traversable nodes according to [egal](http://wiki
.ecmascript.org/doku.php?id=harmony:egal). | |
158 | |
159 _Previously:_ Non-traversable equal via `===`. | |
160 | |
161 ```js | |
162 expect(NaN).to.deep.equal(NaN); | |
163 expect(-0).to.not.deep.equal(+0); | |
164 ``` | |
165 | |
166 **2.** Arguments are not Arrays (and all types must be equal): | |
167 | |
168 _Previously:_ Some crazy nonsense that led to empty arrays deep equaling empty o
bjects deep equaling dates. | |
169 | |
170 ```js | |
171 expect(arguments).to.not.deep.equal([]); | |
172 expect(Array.prototype.slice.call(arguments)).to.deep.equal([]); | |
173 ``` | |
174 | |
175 - [#156](https://github.com/chaijs/chai/issues/156) Empty object is eql to empty
array | |
176 - [#192](https://github.com/chaijs/chai/issues/192) empty object is eql to a Dat
e object | |
177 - [#194](https://github.com/chaijs/chai/issues/194) refactor deep-equal utility | |
178 | |
179 ### CI and Browser Testing | |
180 | |
181 Chai now runs the browser CI suite using [Karma](http://karma-runner.github.io/)
directed at | |
182 [SauceLabs](https://saucelabs.com/). This means we get to know where our browser
support stands... | |
183 and we get a cool badge: | |
184 | |
185 [](https://saucelabs.com/u/logicalparadox) | |
186 | |
187 Look for the list of browsers/versions to expand over the coming releases. | |
188 | |
189 - [#195](https://github.com/chaijs/chai/issues/195) karma test framework | |
190 | |
191 ## 1.7.2 / 2013-06-27 | |
192 | |
193 The following changes are required if you are upgrading from the previous versio
n: | |
194 | |
195 - **Users:** | |
196 - No changes required. | |
197 - **Plugin Developers:** | |
198 - No changes required | |
199 - **Core Contributors:** | |
200 - Refresh `node_modules` folder for updated dependencies. | |
201 | |
202 ### Coverage Reporting | |
203 | |
204 Coverage reporting has always been available for core-developers but the data ha
s never been published | |
205 for our end users. In our ongoing effort to improve accountability this data wil
l now be published via | |
206 the [coveralls.io](https://coveralls.io/) service. A badge has been added to the
README and the full report | |
207 can be viewed online at the [chai coveralls project](https://coveralls.io/r/chai
js/chai). Furthermore, PRs | |
208 will receive automated messages indicating how their PR impacts test coverage. T
his service is tied to TravisCI. | |
209 | |
210 ### Other Fixes | |
211 | |
212 - [#175](https://github.com/chaijs/chai/issues/175) Add `bower.json`. (Fix ignor
e all) | |
213 | |
214 ## 1.7.1 / 2013-06-24 | |
215 | |
216 The following changes are required if you are upgrading from the previous versio
n: | |
217 | |
218 - **Users:** | |
219 - No changes required. | |
220 - **Plugin Developers:** | |
221 - No changes required | |
222 - **Core Contributors:** | |
223 - Refresh `node_modules` folder for updated dependencies. | |
224 | |
225 ### Official Bower Support | |
226 | |
227 Support has been added for the Bower Package Manager ([bower.io])(http://bower.i
o/). Though | |
228 Chai could be installed via Bower in the past, this update adds official support
via the `bower.json` | |
229 specification file. | |
230 | |
231 - [#175](https://github.com/chaijs/chai/issues/175) Add `bower.json`. | |
232 | |
233 ## 1.7.0 / 2013-06-17 | |
234 | |
235 The following changes are required if you are upgrading from the previous versio
n: | |
236 | |
237 - **Users:** | |
238 - No changes required. | |
239 - **Plugin Developers:** | |
240 - Review AssertionError update notice. | |
241 - **Core Contributors:** | |
242 - Refresh `node_modules` folder for updated dependencies. | |
243 | |
244 ### AssertionError Update Notice | |
245 | |
246 Chai now uses [chaijs/assertion-error](https://github.com/chaijs/assertion-error
) instead an internal | |
247 constructor. This will allow for further iteration/experimentation of the Assert
ionError constructor | |
248 independant of Chai. Future plans include stack parsing for callsite support. | |
249 | |
250 This update constructor has a different constructor param signature that conform
s more with the standard | |
251 `Error` object. If your plugin throws and `AssertionError` directly you will nee
d to update your plugin | |
252 with the new signature. | |
253 | |
254 ```js | |
255 var AssertionError = require('chai').AssertionError; | |
256 | |
257 /** | |
258 * previous | |
259 * | |
260 * @param {Object} options | |
261 */ | |
262 | |
263 throw new AssertionError({ | |
264 message: 'An assertion error occurred' | |
265 , actual: actual | |
266 , expect: expect | |
267 , startStackFunction: arguments.callee | |
268 , showStack: true | |
269 }); | |
270 | |
271 /** | |
272 * new | |
273 * | |
274 * @param {String} message | |
275 * @param {Object} options | |
276 * @param {Function} start stack function | |
277 */ | |
278 | |
279 throw new AssertionError('An assertion error occurred', { | |
280 actual: actual | |
281 , expect: expect | |
282 , showStack: true | |
283 }, arguments.callee); | |
284 | |
285 // other signatures | |
286 throw new AssertionError('An assertion error occurred'); | |
287 throw new AssertionError('An assertion error occurred', null, arguments.callee); | |
288 ``` | |
289 | |
290 #### External Dependencies | |
291 | |
292 This is the first non-developement dependency for Chai. As Chai continues to evo
lve we will begin adding | |
293 more; the next will likely be improved type detection and deep equality. With Ch
ai's userbase continually growing | |
294 there is an higher need for accountability and documentation. External dependenc
ies will allow us to iterate and | |
295 test on features independent from our interfaces. | |
296 | |
297 Note: The browser packaged version `chai.js` will ALWAYS contain all dependencie
s needed to run Chai. | |
298 | |
299 ### Community Contributions | |
300 | |
301 - [#169](https://github.com/chaijs/chai/pull/169) Fix deep equal comparison for
Date/Regexp types. [@katsgeorgeek](https://github.com/katsgeorgeek) | |
302 - [#171](https://github.com/chaijs/chai/pull/171) Add `assert.notOk()`. [@Bartvd
s](https://github.com/Bartvds) | |
303 - [#173](https://github.com/chaijs/chai/pull/173) Fix `inspect` utility. [@domen
ic](https://github.com/domenic) | |
304 | |
305 Thank you to all who took the time to contribute! | |
306 | |
307 ## 1.6.1 / 2013-06-05 | |
308 | |
309 The following changes are required if you are upgrading from the previous versio
n: | |
310 | |
311 - **Users:** | |
312 - No changes required. | |
313 - **Plugin Developers:** | |
314 - No changes required. | |
315 - **Core Contributors:** | |
316 - Refresh `node_modules` folder for updated developement dependencies. | |
317 | |
318 ### Deep Equality | |
319 | |
320 Regular Expressions are now tested as part of all deep equality assertions. In p
revious versions | |
321 they silently passed for all scenarios. Thanks to [@katsgeorgeek](https://github
.com/katsgeorgeek) for the contribution. | |
322 | |
323 ### Community Contributions | |
324 | |
325 - [#161](https://github.com/chaijs/chai/pull/161) Fix documented name for assert
interface's isDefined method. [@brandonpayton](https://github.com/brandonpayton
) | |
326 - [#168](https://github.com/chaijs/chai/pull/168) Fix comparison equality of two
regexps for when using deep equality. [@katsgeorgeek](https://github.com/katsge
orgeek) | |
327 | |
328 Thank you to all who took the time to contribute! | |
329 | |
330 ### Additional Notes | |
331 | |
332 - Mocha has been locked at version `1.8.x` to ensure `mocha-phantomjs` compatibi
lity. | |
333 | |
334 ## 1.6.0 / 2013-04-29 | |
335 | |
336 The following changes are required if you are upgrading from the previous versio
n: | |
337 | |
338 - **Users:** | |
339 - No changes required. | |
340 - **Plugin Developers:** | |
341 - No changes required. | |
342 - **Core Contributors:** | |
343 - Refresh `node_modules` folder for updated developement dependencies. | |
344 | |
345 ### New Assertions | |
346 | |
347 #### Array Members Inclusion | |
348 | |
349 Asserts that the target is a superset of `set`, or that the target and `set` hav
e the same members. | |
350 Order is not taken into account. Thanks to [@NickHeiner](https://github.com/Nick
Heiner) for the contribution. | |
351 | |
352 ```js | |
353 // (expect/should) full set | |
354 expect([4, 2]).to.have.members([2, 4]); | |
355 expect([5, 2]).to.not.have.members([5, 2, 1]); | |
356 | |
357 // (expect/should) inclusion | |
358 expect([1, 2, 3]).to.include.members([3, 2]); | |
359 expect([1, 2, 3]).to.not.include.members([3, 2, 8]); | |
360 | |
361 // (assert) full set | |
362 assert.sameMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'same members'); | |
363 | |
364 // (assert) inclusion | |
365 assert.includeMembers([ 1, 2, 3 ], [ 2, 1 ], 'include members'); | |
366 | |
367 ``` | |
368 | |
369 #### Non-inclusion for Assert Interface | |
370 | |
371 Most `assert` functions have a negative version, like `instanceOf()` has a corre
sponding `notInstaceOf()`. | |
372 However `include()` did not have a corresponding `notInclude()`. This has been a
dded. | |
373 | |
374 ```js | |
375 assert.notInclude([ 1, 2, 3 ], 8); | |
376 assert.notInclude('foobar', 'baz'); | |
377 ``` | |
378 | |
379 ### Community Contributions | |
380 | |
381 - [#140](https://github.com/chaijs/chai/pull/140) Restore `call`/`apply` methods
for plugin interface. [@RubenVerborgh](https://github.com/RubenVerborgh) | |
382 - [#148](https://github.com/chaijs/chai/issues/148)/[#153](https://github.com/ch
aijs/chai/pull/153) Add `members` and `include.members` assertions. [#NickHeiner
](https://github.com/NickHeiner) | |
383 | |
384 Thank you to all who took time to contribute! | |
385 | |
386 ### Other Bug Fixes | |
387 | |
388 - [#142](https://github.com/chaijs/chai/issues/142) `assert#include` will no lon
ger silently pass on wrong-type haystack. | |
389 - [#158](https://github.com/chaijs/chai/issues/158) `assert#notInclude` has been
added. | |
390 - 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. | |
391 | |
392 ## 1.5.0 / 2013-02-03 | |
393 | |
394 ### Migration Requirements | |
395 | |
396 The following changes are required if you are upgrading from the previous versio
n: | |
397 | |
398 - **Users:** | |
399 - _Update [2013-02-04]:_ Some users may notice a small subset of deep equality
assertions will no longer pass. This is the result of | |
400 [#120](https://github.com/chaijs/chai/issues/120), an improvement to our deep
equality algorithm. Users will need to revise their assertions | |
401 to be more granular should this occur. Further information: [#139](https://git
hub.com/chaijs/chai/issues/139). | |
402 - **Plugin Developers:** | |
403 - No changes required. | |
404 - **Core Contributors:** | |
405 - Refresh `node_modules` folder for updated developement dependencies. | |
406 | |
407 ### Community Contributions | |
408 | |
409 - [#126](https://github.com/chaijs/chai/pull/126): Add `eqls` alias for `eql`. [
@RubenVerborgh](https://github.com/RubenVerborgh) | |
410 - [#127](https://github.com/chaijs/chai/issues/127): Performance refactor for ch
ainable methods. [@RubenVerborgh](https://github.com/RubenVerborgh) | |
411 - [#133](https://github.com/chaijs/chai/pull/133): Assertion `.throw` support fo
r primitives. [@RubenVerborgh](https://github.com/RubenVerborgh) | |
412 - [#137](https://github.com/chaijs/chai/issues/137): Assertion `.throw` support
for empty messages. [@timnew](https://github.com/timnew) | |
413 - [#136](https://github.com/chaijs/chai/pull/136): Fix backward negation message
s when using `.above()` and `.below()`. [@whatthejeff](https://github.com/whatth
ejeff) | |
414 | |
415 Thank you to all who took time to contribute! | |
416 | |
417 ### Other Bug Fixes | |
418 | |
419 - Improve type detection of `.a()`/`.an()` to work in cross-browser scenarios. | |
420 - [#116](https://github.com/chaijs/chai/issues/116): `.throw()` has cleaner disp
lay of errors when WebKit browsers. | |
421 - [#120](https://github.com/chaijs/chai/issues/120): `.eql()` now works to compa
re dom nodes in browsers. | |
422 | |
423 | |
424 ### Usage Updates | |
425 | |
426 #### For Users | |
427 | |
428 **1. Component Support:** Chai now included the proper configuration to be insta
lled as a | |
429 [component](https://github.com/component/component). Component users are encoura
ged to consult | |
430 [chaijs.com](http://chaijs.com) for the latest version number as using the maste
r branch | |
431 does not gaurantee stability. | |
432 | |
433 ```js | |
434 // relevant component.json | |
435 devDependencies: { | |
436 "chaijs/chai": "1.5.0" | |
437 } | |
438 ``` | |
439 | |
440 Alternatively, bleeding-edge is available: | |
441 | |
442 $ component install chaijs/chai | |
443 | |
444 **2. Configurable showDiff:** Some test runners (such as [mocha](http://visionme
dia.github.com/mocha/)) | |
445 include support for showing the diff of strings and objects when an equality err
or occurs. Chai has | |
446 already included support for this, however some users may not prefer this displa
y behavior. To revert to | |
447 no diff display, the following configuration is available: | |
448 | |
449 ```js | |
450 chai.Assertion.showDiff = false; // diff output disabled | |
451 chai.Assertion.showDiff = true; // default, diff output enabled | |
452 ``` | |
453 | |
454 #### For Plugin Developers | |
455 | |
456 **1. New Utility - type**: The new utility `.type()` is available as a better im
plementation of `typeof` | |
457 that can be used cross-browser. It handles the inconsistencies of Array, `null`,
and `undefined` detection. | |
458 | |
459 - **@param** _{Mixed}_ object to detect type of | |
460 - **@return** _{String}_ object type | |
461 | |
462 ```js | |
463 chai.use(function (c, utils) { | |
464 // some examples | |
465 utils.type({}); // 'object' | |
466 utils.type(null); // `null' | |
467 utils.type(undefined); // `undefined` | |
468 utils.type([]); // `array` | |
469 }); | |
470 ``` | |
471 | |
472 #### For Core Contributors | |
473 | |
474 **1. Browser Testing**: Browser testing of the `./chai.js` file is now available
in the command line | |
475 via PhantomJS. `make test` and Travis-CI will now also rebuild and test `./chai.
js`. Consequently, all | |
476 pull requests will now be browser tested in this way. | |
477 | |
478 _Note: Contributors opening pull requests should still NOT include the browser b
uild._ | |
479 | |
480 **2. SauceLabs Testing**: Early SauceLab support has been enabled with the file
`./support/mocha-cloud.js`. | |
481 Those interested in trying it out should create a free [Open Sauce](https://sauc
elabs.com/signup/plan) account | |
482 and include their credentials in `./test/auth/sauce.json`. | |
OLD | NEW |