Dieses Repository beinhaltet HTML- und Javascript Code zur einer NotizenWebApp auf Basis von Web Storage. Zudem sind Mocha/Chai Tests im Browser enthalten. https://meinenotizen.netlify.app/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ReleaseNotes.md 29KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737
  1. # Release Notes
  2. ## Note
  3. As of 3.0.0, the ReleaseNotes.md file has been deprecated. [Please refer to the release notes available on Github](https://github.com/chaijs/chai/releases). Or
  4. [the release notes on the chaijs.com website](https://chaijs.com/releases).
  5. ---
  6. ## 2.3.0 / 2015-04-26
  7. Added `ownPropertyDescriptor` assertion:
  8. ```js
  9. expect('test').to.have.ownPropertyDescriptor('length');
  10. expect('test').to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 });
  11. expect('test').not.to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 });
  12. expect('test').ownPropertyDescriptor('length').to.have.property('enumerable', false);
  13. expect('test').ownPropertyDescriptor('length').to.have.keys('value');
  14. ```
  15. ### Community Contributions
  16. #### Code Features & Fixes
  17. * [#408](https://github.com/chaijs/chai/pull/408) Add `ownPropertyDescriptor`
  18. assertion.
  19. By [@ljharb](https://github.com/ljharb)
  20. * [#422](https://github.com/chaijs/chai/pull/422) Improve ownPropertyDescriptor
  21. tests.
  22. By [@ljharb](https://github.com/ljharb)
  23. #### Documentation fixes
  24. * [#417](https://github.com/chaijs/chai/pull/417) Fix documentation typo
  25. By [@astorije](https://github.com/astorije)
  26. * [#423](https://github.com/chaijs/chai/pull/423) Fix inconsistency in docs.
  27. By [@ehntoo](https://github.com/ehntoo)
  28. ## 2.2.0 / 2015-03-26
  29. Deep property strings can now be escaped using `\\` - for example:
  30. ```js
  31. var deepCss = { '.link': { '[target]': 42 }};
  32. expect(deepCss).to.have.deep.property('\\.link.\\[target\\]', 42)
  33. ```
  34. ### Community Contributions
  35. #### Code Features & Fixes
  36. * [#402](https://github.com/chaijs/chai/pull/402) Allow escaping of deep
  37. property keys.
  38. By [@umireon](https://github.com/umireon)
  39. #### Documentation fixes
  40. * [#405](https://github.com/chaijs/chai/pull/405) Tweak documentation around
  41. deep property escaping.
  42. By [@keithamus](https://github.com/keithamus)
  43. ## 2.1.2 / 2015-03-15
  44. A minor bug fix. No new features.
  45. ### Community Contributions
  46. #### Code Features & Fixes
  47. * [#395](https://github.com/chaijs/chai/pull/395) Fix eval-related bugs with
  48. assert.operator ([#386](https://github.com/chaijs/chai/pull/386)).
  49. By [@cjqed](https://github.com/cjqed)
  50. ## 2.1.1 / 2015-03-04
  51. Two minor bugfixes. No new features.
  52. ### Community Contributions
  53. #### Code Features & Fixes
  54. * [#385](https://github.com/chaijs/chai/pull/385) Fix a bug (also described in
  55. [#387](https://github.com/chaijs/chai/pull/385)) where `deep.property` would not work with single
  56. key names. By [@eldritch-fossicker](https://github.com/eldritch-fossicker)
  57. * [#379](https://github.com/chaijs/chai/pull/379) Fix bug where tools which overwrite
  58. primitive prototypes, such as Babel or core-js would fail.
  59. By [@dcneiner](https://github.com/dcneiner)
  60. #### Documentation fixes
  61. * [#382](https://github.com/chaijs/chai/pull/382) Add doc for showDiff argument in assert.
  62. By [@astorije](https://github.com/astorije)
  63. * [#383](https://github.com/chaijs/chai/pull/383) Improve wording for truncateTreshold docs
  64. By [@gurdiga](https://github.com/gurdiga)
  65. * [#381](https://github.com/chaijs/chai/pull/381) Improve wording for assert.empty docs
  66. By [@astorije](https://github.com/astorije)
  67. ## 2.1.0 / 2015-02-23
  68. Small release; fixes an issue where the Chai lib was incorrectly reporting the
  69. version number.
  70. Adds new `should.fail()` and `expect.fail()` methods, which are convinience
  71. methods to throw Assertion Errors.
  72. ### Community Contributions
  73. #### Code Features & Fixes
  74. * [#356](https://github.com/chaijs/chai/pull/356) Add should.fail(), expect.fail(). By [@Soviut](https://github.com/Soviut)
  75. * [#374](https://github.com/chaijs/chai/pull/374) Increment version. By [@jmm](https://github.com/jmm)
  76. ## 2.0.0 / 2015-02-09
  77. Unfortunately with 1.10.0 - compatibility broke with older versions because of
  78. the `addChainableNoop`. This change has been reverted.
  79. Any plugins using `addChainableNoop` should cease to do so.
  80. Any developers wishing for this behaviour can use [dirty-chai](https://www.npmjs.com/package/dirty-chai)
  81. by [@joshperry](https://github.com/joshperry)
  82. ### Community Contributions
  83. #### Code Features & Fixes
  84. * [#361](https://github.com/chaijs/chai/pull/361) `.keys()` now accepts Objects, extracting keys from them. By [@gregglind](https://github.com/gregglind)
  85. * [#359](https://github.com/chaijs/chai/pull/359) `.keys()` no longer mutates passed arrays. By [@gregglind](https://github.com/gregglind)
  86. * [#349](https://github.com/chaijs/chai/pull/349) Add a new chainable keyword - `.which`. By [@toastynerd](https://github.com/toastynerd)
  87. * [#333](https://github.com/chaijs/chai/pull/333) Add `.change`, `.increase` and `.decrease` assertions. By [@cmpolis](https://github.com/cmpolis)
  88. * [#335](https://github.com/chaijs/chai/pull/335) `chai.util` is now exposed [@DingoEatingFuzz](https://github.com/DingoEatingFuzz)
  89. * [#328](https://github.com/chaijs/chai/pull/328) Add `.includes` and `.contains` aliases (for `.include` and `.contain`). By [@lo1tuma](https://github.com/lo1tuma)
  90. * [#313](https://github.com/chaijs/chai/pull/313) Add `.any.keys()` and `.all.keys()` qualifiers. By [@cjqed](https://github.com/cjqed)
  91. * [#312](https://github.com/chaijs/chai/pull/312) Add `assert.sameDeepMembers()`. By [@cjqed](https://github.com/cjqed)
  92. * [#311](https://github.com/chaijs/chai/pull/311) Add `assert.isAbove()` and `assert.isBelow()`. By [@cjqed](https://github.com/cjqed)
  93. * [#308](https://github.com/chaijs/chai/pull/308) `property` and `deep.property` now pass if a value is set to `undefined`. By [@prodatakey](https://github.com/prodatakey)
  94. * [#309](https://github.com/chaijs/chai/pull/309) optimize deep equal in Arrays. By [@ericdouglas](https://github.com/ericdouglas)
  95. * [#306](https://github.com/chaijs/chai/pull/306) revert #297 - allowing lint-friendly tests. By [@keithamus](https://github.com/keithamus)
  96. #### Documentation fixes
  97. * [#357](https://github.com/chaijs/chai/pull/357) Copyright year updated in docs. By [@danilovaz](https://github.com/danilovaz)
  98. * [#325](https://github.com/chaijs/chai/pull/325) Fix documentation for overwriteChainableMethod. By [@chasenlehara](https://github.com/chasenlehara)
  99. * [#334](https://github.com/chaijs/chai/pull/334) Typo fix. By [@hurrymaplelad](https://github.com/hurrymaplelad)
  100. * [#317](https://github.com/chaijs/chai/pull/317) Typo fix. By [@jasonkarns](https://github.com/jasonkarns)
  101. * [#318](https://github.com/chaijs/chai/pull/318) Typo fix. By [@jasonkarns](https://github.com/jasonkarns)
  102. * [#316](https://github.com/chaijs/chai/pull/316) Typo fix. By [@jasonkarns](https://github.com/jasonkarns)
  103. ## 1.10.0 / 2014-11-10
  104. The following changes are required if you are upgrading from the previous version:
  105. - **Users:**
  106. - No changes required
  107. - **Plugin Developers:**
  108. - Review `addChainableNoop` notes below.
  109. - **Core Contributors:**
  110. - Refresh `node_modules` folder for updated dependencies.
  111. ### Noop Function for Terminating Assertion Properties
  112. The following assertions can now also be used in the function-call form:
  113. * ok
  114. * true
  115. * false
  116. * null
  117. * undefined
  118. * exist
  119. * empty
  120. * arguments
  121. * Arguments
  122. The above list of assertions are property getters that assert immediately on
  123. access. Because of that, they were written to be used by terminating the assertion
  124. chain with a property access.
  125. ```js
  126. expect(true).to.be.true;
  127. foo.should.be.ok;
  128. ```
  129. This syntax is definitely aesthetically pleasing but, if you are linting your
  130. test code, your linter will complain with an error something like "Expected an
  131. assignment or function call and instead saw an expression." Since the linter
  132. doesn't know about the property getter it assumes this line has no side-effects,
  133. and throws a warning in case you made a mistake.
  134. Squelching these errors is not a good solution as test code is getting to be
  135. just as important as, if not more than, production code. Catching syntactical
  136. errors in tests using static analysis is a great tool to help make sure that your
  137. tests are well-defined and free of typos.
  138. A better option was to provide a function-call form for these assertions so that
  139. the code's intent is more clear and the linters stop complaining about something
  140. looking off. This form is added in addition to the existing property access form
  141. and does not impact existing test code.
  142. ```js
  143. expect(true).to.be.true();
  144. foo.should.be.ok();
  145. ```
  146. These forms can also be mixed in any way, these are all functionally identical:
  147. ```js
  148. expect(true).to.be.true.and.not.false();
  149. expect(true).to.be.true().and.not.false;
  150. expect(true).to.be.true.and.not.false;
  151. ```
  152. #### Plugin Authors
  153. If you would like to provide this function-call form for your terminating assertion
  154. properties, there is a new function to register these types of asserts. Instead
  155. of using `addProperty` to register terminating assertions, simply use `addChainableNoop`
  156. instead; the arguments to both are identical. The latter will make the assertion
  157. available in both the attribute and function-call forms and should have no impact
  158. on existing users of your plugin.
  159. ### Community Contributions
  160. - [#297](https://github.com/chaijs/chai/pull/297) Allow writing lint-friendly tests. [@joshperry](https://github.com/joshperry)
  161. - [#298](https://github.com/chaijs/chai/pull/298) Add check for logging `-0`. [@dasilvacontin](https://github.com/dasilvacontin)
  162. - [#300](https://github.com/chaijs/chai/pull/300) Fix #299: the test is defining global variables [@julienw](https://github.com/julienw)
  163. Thank you to all who took time to contribute!
  164. ## 1.9.2 / 2014-09-29
  165. The following changes are required if you are upgrading from the previous version:
  166. - **Users:**
  167. - No changes required
  168. - **Plugin Developers:**
  169. - No changes required
  170. - **Core Contributors:**
  171. - Refresh `node_modules` folder for updated dependencies.
  172. ### Community Contributions
  173. - [#264](https://github.com/chaijs/chai/pull/264) Show diff for keys assertions [@cjthompson](https://github.com/cjthompson)
  174. - [#267](https://github.com/chaijs/chai/pull/267) Use SVG badges [@shinnn](https://github.com/shinnn)
  175. - [#268](https://github.com/chaijs/chai/pull/268) Allow messages to be functions (sinon-compat) [@charlierudolph](https://github.com/charlierudolph)
  176. - [#269](https://github.com/chaijs/chai/pull/269) Remove unused argument for #lengthOf [@charlierudolph](https://github.com/charlierudolph)
  177. - [#275](https://github.com/chaijs/chai/pull/275) Rewrite pretty-printing HTML elements to prevent throwing internal errors [@DrRataplan](https://github.com/DrRataplan)
  178. - [#277](https://github.com/chaijs/chai/pull/277) Fix assert documentation for #sameMembers [@charlierudolph](https://github.com/charlierudolph)
  179. - [#279](https://github.com/chaijs/chai/pull/279) closeTo should check value's type before assertion [@mohayonao](https://github.com/mohayonao)
  180. - [#289](https://github.com/chaijs/chai/pull/289) satisfy is called twice [@charlierudolph](https://github.com/charlierudolph)
  181. - [#292](https://github.com/chaijs/chai/pull/292) resolve conflicts with node-webkit and global usage [@boneskull](https://github.com/boneskull)
  182. Thank you to all who took time to contribute!
  183. ## 1.9.1 / 2014-03-19
  184. The following changes are required if you are upgrading from the previous version:
  185. - **Users:**
  186. - Migrate configuration options to new interface. (see notes)
  187. - **Plugin Developers:**
  188. - No changes required
  189. - **Core Contributors:**
  190. - Refresh `node_modules` folder for updated dependencies.
  191. ### Configuration
  192. There have been requests for changes and additions to the configuration mechanisms
  193. and their impact in the Chai architecture. As such, we have decoupled the
  194. configuration from the `Assertion` constructor. This not only allows for centralized
  195. configuration, but will allow us to shift the responsibility from the `Assertion`
  196. constructor to the `assert` interface in future releases.
  197. These changes have been implemented in a non-breaking way, but a depretiation
  198. warning will be presented to users until they migrate. The old config method will
  199. be removed in either `v1.11.0` or `v2.0.0`, whichever comes first.
  200. #### Quick Migration
  201. ```js
  202. // change this:
  203. chai.Assertion.includeStack = true;
  204. chai.Assertion.showDiff = false;
  205. // ... to this:
  206. chai.config.includeStack = true;
  207. chai.config.showDiff = false;
  208. ```
  209. #### All Config Options
  210. ##### config.includeStack
  211. - **@param** _{Boolean}_
  212. - **@default** `false`
  213. User configurable property, influences whether stack trace is included in
  214. Assertion error message. Default of `false` suppresses stack trace in the error
  215. message.
  216. ##### config.showDiff
  217. - **@param** _{Boolean}_
  218. - **@default** `true`
  219. User configurable property, influences whether or not the `showDiff` flag
  220. should be included in the thrown AssertionErrors. `false` will always be `false`;
  221. `true` will be true when the assertion has requested a diff be shown.
  222. ##### config.truncateThreshold **(NEW)**
  223. - **@param** _{Number}_
  224. - **@default** `40`
  225. User configurable property, sets length threshold for actual and expected values
  226. in assertion errors. If this threshold is exceeded, the value is truncated.
  227. Set it to zero if you want to disable truncating altogether.
  228. ```js
  229. chai.config.truncateThreshold = 0; // disable truncating
  230. ```
  231. ### Community Contributions
  232. - [#228](https://github.com/chaijs/chai/pull/228) Deep equality check for memebers. [@duncanbeevers](https://github.com/duncanbeevers)
  233. - [#247](https://github.com/chaijs/chai/pull/247) Proofreading. [@didorellano](https://github.com/didoarellano)
  234. - [#244](https://github.com/chaijs/chai/pull/244) Fix `contain`/`include` 1.9.0 regression. [@leider](https://github.com/leider)
  235. - [#233](https://github.com/chaijs/chai/pull/233) Improvements to `ssfi` for `assert` interface. [@refack](https://github.com/refack)
  236. - [#251](https://github.com/chaijs/chai/pull/251) New config option: object display threshold. [@romario333](https://github.com/romario333)
  237. Thank you to all who took time to contribute!
  238. ### Other Bug Fixes
  239. - [#183](https://github.com/chaijs/chai/issues/183) Allow `undefined` for actual. (internal api)
  240. - Update Karam(+plugins)/Istanbul to most recent versions.
  241. ## 1.9.0 / 2014-01-29
  242. The following changes are required if you are upgrading from the previous version:
  243. - **Users:**
  244. - No changes required
  245. - **Plugin Developers:**
  246. - Review [#219](https://github.com/chaijs/chai/pull/219).
  247. - **Core Contributors:**
  248. - Refresh `node_modules` folder for updated dependencies.
  249. ### Community Contributions
  250. - [#202](https://github.com/chaijs/chai/pull/201) Improve error message for .throw(). [@andreineculau](https://github.com/andreineculau)
  251. - [#217](https://github.com/chaijs/chai/pull/217) Chai tests can be run with `--watch`. [@demands](https://github.com/demands)
  252. - [#219](https://github.com/chaijs/chai/pull/219) Add overwriteChainableMethod utility. [@demands](https://github.com/demands)
  253. - [#224](https://github.com/chaijs/chai/pull/224) Return error on throw method to chain on error properties. [@vbardales](https://github.com/vbardales)
  254. - [#226](https://github.com/chaijs/chai/pull/226) Add `has` to language chains. [@duncanbeevers](https://github.com/duncanbeevers)
  255. - [#230](https://github.com/chaijs/chai/pull/230) Support `{a:1,b:2}.should.include({a:1})` [@jkroso](https://github.com/jkroso)
  256. - [#231](https://github.com/chaijs/chai/pull/231) Update Copyright notices to 2014 [@duncanbeevers](https://github.com/duncanbeevers)
  257. - [#232](https://github.com/chaijs/chai/pull/232) Avoid error instantiation if possible on assert.throws. [@laconbass](https://github.com/laconbass)
  258. Thank you to all who took time to contribute!
  259. ### Other Bug Fixes
  260. - [#225](https://github.com/chaijs/chai/pull/225) Improved AMD wrapper provided by upstream `component(1)`.
  261. - [#185](https://github.com/chaijs/chai/issues/185) `assert.throws()` returns thrown error for further assertions.
  262. - [#237](https://github.com/chaijs/chai/pull/237) Remove coveralls/jscoverage, include istanbul coverage report in travis test.
  263. - Update Karma and Sauce runner versions for consistent CI results. No more karma@canary.
  264. ## 1.8.1 / 2013-10-10
  265. The following changes are required if you are upgrading from the previous version:
  266. - **Users:**
  267. - Refresh `node_modules` folder for updated dependencies.
  268. - **Plugin Developers:**
  269. - No changes required
  270. - **Core Contributors:**
  271. - Refresh `node_modules` folder for updated dependencies.
  272. ### Browserify
  273. This is a small patch that updates the dependency tree so browserify users can install
  274. chai. (Remove conditional requires)
  275. ## 1.8.0 / 2013-09-18
  276. The following changes are required if you are upgrading from the previous version:
  277. - **Users:**
  278. - See `deep.equal` notes.
  279. - **Plugin Developers:**
  280. - No changes required
  281. - **Core Contributors:**
  282. - Refresh `node_modules` folder for updated dependencies.
  283. ### Deep Equals
  284. This version of Chai focused on a overhaul to the deep equal utility. The code for this
  285. tool has been removed from the core lib and can now be found at:
  286. [chai / deep-eql](https://github.com/chaijs/deep-eql). As stated in previous releases,
  287. this is part of a larger initiative to provide transparency, independent testing, and coverage for
  288. some of the more complicated internal tools.
  289. For the most part `.deep.equal` will behave the same as it has. However, in order to provide a
  290. consistent ruleset across all types being tested, the following changes have been made and _might_
  291. require changes to your tests.
  292. **1.** Strict equality for non-traversable nodes according to [egal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
  293. _Previously:_ Non-traversable equal via `===`.
  294. ```js
  295. expect(NaN).to.deep.equal(NaN);
  296. expect(-0).to.not.deep.equal(+0);
  297. ```
  298. **2.** Arguments are not Arrays (and all types must be equal):
  299. _Previously:_ Some crazy nonsense that led to empty arrays deep equaling empty objects deep equaling dates.
  300. ```js
  301. expect(arguments).to.not.deep.equal([]);
  302. expect(Array.prototype.slice.call(arguments)).to.deep.equal([]);
  303. ```
  304. - [#156](https://github.com/chaijs/chai/issues/156) Empty object is eql to empty array
  305. - [#192](https://github.com/chaijs/chai/issues/192) empty object is eql to a Date object
  306. - [#194](https://github.com/chaijs/chai/issues/194) refactor deep-equal utility
  307. ### CI and Browser Testing
  308. Chai now runs the browser CI suite using [Karma](http://karma-runner.github.io/) directed at
  309. [SauceLabs](https://saucelabs.com/). This means we get to know where our browser support stands...
  310. and we get a cool badge:
  311. [![Selenium Test Status](https://saucelabs.com/browser-matrix/logicalparadox.svg)](https://saucelabs.com/u/logicalparadox)
  312. Look for the list of browsers/versions to expand over the coming releases.
  313. - [#195](https://github.com/chaijs/chai/issues/195) karma test framework
  314. ## 1.7.2 / 2013-06-27
  315. The following changes are required if you are upgrading from the previous version:
  316. - **Users:**
  317. - No changes required.
  318. - **Plugin Developers:**
  319. - No changes required
  320. - **Core Contributors:**
  321. - Refresh `node_modules` folder for updated dependencies.
  322. ### Coverage Reporting
  323. Coverage reporting has always been available for core-developers but the data has never been published
  324. for our end users. In our ongoing effort to improve accountability this data will now be published via
  325. the [coveralls.io](https://coveralls.io/) service. A badge has been added to the README and the full report
  326. can be viewed online at the [chai coveralls project](https://coveralls.io/r/chaijs/chai). Furthermore, PRs
  327. will receive automated messages indicating how their PR impacts test coverage. This service is tied to TravisCI.
  328. ### Other Fixes
  329. - [#175](https://github.com/chaijs/chai/issues/175) Add `bower.json`. (Fix ignore all)
  330. ## 1.7.1 / 2013-06-24
  331. The following changes are required if you are upgrading from the previous version:
  332. - **Users:**
  333. - No changes required.
  334. - **Plugin Developers:**
  335. - No changes required
  336. - **Core Contributors:**
  337. - Refresh `node_modules` folder for updated dependencies.
  338. ### Official Bower Support
  339. Support has been added for the Bower Package Manager ([bower.io])(http://bower.io/). Though
  340. Chai could be installed via Bower in the past, this update adds official support via the `bower.json`
  341. specification file.
  342. - [#175](https://github.com/chaijs/chai/issues/175) Add `bower.json`.
  343. ## 1.7.0 / 2013-06-17
  344. The following changes are required if you are upgrading from the previous version:
  345. - **Users:**
  346. - No changes required.
  347. - **Plugin Developers:**
  348. - Review AssertionError update notice.
  349. - **Core Contributors:**
  350. - Refresh `node_modules` folder for updated dependencies.
  351. ### AssertionError Update Notice
  352. Chai now uses [chaijs/assertion-error](https://github.com/chaijs/assertion-error) instead an internal
  353. constructor. This will allow for further iteration/experimentation of the AssertionError constructor
  354. independant of Chai. Future plans include stack parsing for callsite support.
  355. This update constructor has a different constructor param signature that conforms more with the standard
  356. `Error` object. If your plugin throws and `AssertionError` directly you will need to update your plugin
  357. with the new signature.
  358. ```js
  359. var AssertionError = require('chai').AssertionError;
  360. /**
  361. * previous
  362. *
  363. * @param {Object} options
  364. */
  365. throw new AssertionError({
  366. message: 'An assertion error occurred'
  367. , actual: actual
  368. , expect: expect
  369. , startStackFunction: arguments.callee
  370. , showStack: true
  371. });
  372. /**
  373. * new
  374. *
  375. * @param {String} message
  376. * @param {Object} options
  377. * @param {Function} start stack function
  378. */
  379. throw new AssertionError('An assertion error occurred', {
  380. actual: actual
  381. , expect: expect
  382. , showStack: true
  383. }, arguments.callee);
  384. // other signatures
  385. throw new AssertionError('An assertion error occurred');
  386. throw new AssertionError('An assertion error occurred', null, arguments.callee);
  387. ```
  388. #### External Dependencies
  389. This is the first non-developement dependency for Chai. As Chai continues to evolve we will begin adding
  390. more; the next will likely be improved type detection and deep equality. With Chai's userbase continually growing
  391. there is an higher need for accountability and documentation. External dependencies will allow us to iterate and
  392. test on features independent from our interfaces.
  393. Note: The browser packaged version `chai.js` will ALWAYS contain all dependencies needed to run Chai.
  394. ### Community Contributions
  395. - [#169](https://github.com/chaijs/chai/pull/169) Fix deep equal comparison for Date/Regexp types. [@katsgeorgeek](https://github.com/katsgeorgeek)
  396. - [#171](https://github.com/chaijs/chai/pull/171) Add `assert.notOk()`. [@Bartvds](https://github.com/Bartvds)
  397. - [#173](https://github.com/chaijs/chai/pull/173) Fix `inspect` utility. [@domenic](https://github.com/domenic)
  398. Thank you to all who took the time to contribute!
  399. ## 1.6.1 / 2013-06-05
  400. The following changes are required if you are upgrading from the previous version:
  401. - **Users:**
  402. - No changes required.
  403. - **Plugin Developers:**
  404. - No changes required.
  405. - **Core Contributors:**
  406. - Refresh `node_modules` folder for updated developement dependencies.
  407. ### Deep Equality
  408. Regular Expressions are now tested as part of all deep equality assertions. In previous versions
  409. they silently passed for all scenarios. Thanks to [@katsgeorgeek](https://github.com/katsgeorgeek) for the contribution.
  410. ### Community Contributions
  411. - [#161](https://github.com/chaijs/chai/pull/161) Fix documented name for assert interface's isDefined method. [@brandonpayton](https://github.com/brandonpayton)
  412. - [#168](https://github.com/chaijs/chai/pull/168) Fix comparison equality of two regexps for when using deep equality. [@katsgeorgeek](https://github.com/katsgeorgeek)
  413. Thank you to all who took the time to contribute!
  414. ### Additional Notes
  415. - Mocha has been locked at version `1.8.x` to ensure `mocha-phantomjs` compatibility.
  416. ## 1.6.0 / 2013-04-29
  417. The following changes are required if you are upgrading from the previous version:
  418. - **Users:**
  419. - No changes required.
  420. - **Plugin Developers:**
  421. - No changes required.
  422. - **Core Contributors:**
  423. - Refresh `node_modules` folder for updated developement dependencies.
  424. ### New Assertions
  425. #### Array Members Inclusion
  426. Asserts that the target is a superset of `set`, or that the target and `set` have the same members.
  427. Order is not taken into account. Thanks to [@NickHeiner](https://github.com/NickHeiner) for the contribution.
  428. ```js
  429. // (expect/should) full set
  430. expect([4, 2]).to.have.members([2, 4]);
  431. expect([5, 2]).to.not.have.members([5, 2, 1]);
  432. // (expect/should) inclusion
  433. expect([1, 2, 3]).to.include.members([3, 2]);
  434. expect([1, 2, 3]).to.not.include.members([3, 2, 8]);
  435. // (assert) full set
  436. assert.sameMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'same members');
  437. // (assert) inclusion
  438. assert.includeMembers([ 1, 2, 3 ], [ 2, 1 ], 'include members');
  439. ```
  440. #### Non-inclusion for Assert Interface
  441. Most `assert` functions have a negative version, like `instanceOf()` has a corresponding `notInstaceOf()`.
  442. However `include()` did not have a corresponding `notInclude()`. This has been added.
  443. ```js
  444. assert.notInclude([ 1, 2, 3 ], 8);
  445. assert.notInclude('foobar', 'baz');
  446. ```
  447. ### Community Contributions
  448. - [#140](https://github.com/chaijs/chai/pull/140) Restore `call`/`apply` methods for plugin interface. [@RubenVerborgh](https://github.com/RubenVerborgh)
  449. - [#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)
  450. Thank you to all who took time to contribute!
  451. ### Other Bug Fixes
  452. - [#142](https://github.com/chaijs/chai/issues/142) `assert#include` will no longer silently pass on wrong-type haystack.
  453. - [#158](https://github.com/chaijs/chai/issues/158) `assert#notInclude` has been added.
  454. - 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.
  455. ## 1.5.0 / 2013-02-03
  456. ### Migration Requirements
  457. The following changes are required if you are upgrading from the previous version:
  458. - **Users:**
  459. - _Update [2013-02-04]:_ Some users may notice a small subset of deep equality assertions will no longer pass. This is the result of
  460. [#120](https://github.com/chaijs/chai/issues/120), an improvement to our deep equality algorithm. Users will need to revise their assertions
  461. to be more granular should this occur. Further information: [#139](https://github.com/chaijs/chai/issues/139).
  462. - **Plugin Developers:**
  463. - No changes required.
  464. - **Core Contributors:**
  465. - Refresh `node_modules` folder for updated developement dependencies.
  466. ### Community Contributions
  467. - [#126](https://github.com/chaijs/chai/pull/126): Add `eqls` alias for `eql`. [@RubenVerborgh](https://github.com/RubenVerborgh)
  468. - [#127](https://github.com/chaijs/chai/issues/127): Performance refactor for chainable methods. [@RubenVerborgh](https://github.com/RubenVerborgh)
  469. - [#133](https://github.com/chaijs/chai/pull/133): Assertion `.throw` support for primitives. [@RubenVerborgh](https://github.com/RubenVerborgh)
  470. - [#137](https://github.com/chaijs/chai/issues/137): Assertion `.throw` support for empty messages. [@timnew](https://github.com/timnew)
  471. - [#136](https://github.com/chaijs/chai/pull/136): Fix backward negation messages when using `.above()` and `.below()`. [@whatthejeff](https://github.com/whatthejeff)
  472. Thank you to all who took time to contribute!
  473. ### Other Bug Fixes
  474. - Improve type detection of `.a()`/`.an()` to work in cross-browser scenarios.
  475. - [#116](https://github.com/chaijs/chai/issues/116): `.throw()` has cleaner display of errors when WebKit browsers.
  476. - [#120](https://github.com/chaijs/chai/issues/120): `.eql()` now works to compare dom nodes in browsers.
  477. ### Usage Updates
  478. #### For Users
  479. **1. Component Support:** Chai now included the proper configuration to be installed as a
  480. [component](https://github.com/component/component). Component users are encouraged to consult
  481. [chaijs.com](http://chaijs.com) for the latest version number as using the master branch
  482. does not gaurantee stability.
  483. ```js
  484. // relevant component.json
  485. devDependencies: {
  486. "chaijs/chai": "1.5.0"
  487. }
  488. ```
  489. Alternatively, bleeding-edge is available:
  490. $ component install chaijs/chai
  491. **2. Configurable showDiff:** Some test runners (such as [mocha](http://visionmedia.github.com/mocha/))
  492. include support for showing the diff of strings and objects when an equality error occurs. Chai has
  493. already included support for this, however some users may not prefer this display behavior. To revert to
  494. no diff display, the following configuration is available:
  495. ```js
  496. chai.Assertion.showDiff = false; // diff output disabled
  497. chai.Assertion.showDiff = true; // default, diff output enabled
  498. ```
  499. #### For Plugin Developers
  500. **1. New Utility - type**: The new utility `.type()` is available as a better implementation of `typeof`
  501. that can be used cross-browser. It handles the inconsistencies of Array, `null`, and `undefined` detection.
  502. - **@param** _{Mixed}_ object to detect type of
  503. - **@return** _{String}_ object type
  504. ```js
  505. chai.use(function (c, utils) {
  506. // some examples
  507. utils.type({}); // 'object'
  508. utils.type(null); // `null'
  509. utils.type(undefined); // `undefined`
  510. utils.type([]); // `array`
  511. });
  512. ```
  513. #### For Core Contributors
  514. **1. Browser Testing**: Browser testing of the `./chai.js` file is now available in the command line
  515. via PhantomJS. `make test` and Travis-CI will now also rebuild and test `./chai.js`. Consequently, all
  516. pull requests will now be browser tested in this way.
  517. _Note: Contributors opening pull requests should still NOT include the browser build._
  518. **2. SauceLabs Testing**: Early SauceLab support has been enabled with the file `./support/mocha-cloud.js`.
  519. Those interested in trying it out should create a free [Open Sauce](https://saucelabs.com/signup/plan) account
  520. and include their credentials in `./test/auth/sauce.json`.