This version is outdated! Click here to see latest



BDD/TDD assertion library for node.js and the browser. Test framework agnostic.

(test, assertion, assert, testing, chai)

Critical or Security advisories for 4.0.0-canary.2

This version doesn't have any advisory. Want to report one?

Changelog for 4.0.0-canary.2

4.0.0-canary.2 / 2017-04-17

The second release in the 4.0.0 canary release cycle. Around the end of April, barring any showstopper bugs, this will be released as 4.0.0

Breaking Changes

  • We've dropped support for Node 0.10 (See #816) and Node 0.12 (#901). The minimum supported version is now Node 4.0. If you wish to continue using older versions of Node with Chai, please continue to use the 3.5.0 release. Officially, version 4.0.0 of chai supports Nodes 4, 6, 7, as well as the moving LTS version (currently 6.10.2). We plan to support Node 4 until at-least April 2018 (inline with Node Foundation support).

  • .not.keys on its own is now the equivalent of .not.all.keys (#924). The docs mention this, and suggest to always pair .keys with something.

New Features

  • Added side-effectful "register" style scripts for each interface, (See #868). This allows one to require('chai/should') which will automatically call global.should = chai.should(). This is useful for users who wish to automatically get a global for their codebase. Read the docs for more info!

  • Added the browser field to the package json (#875). This will help with browser bundling tools.

  • Added .own.include and .nested.include (#926).

  • If you attempt to call .throws with something that isn't a constructor (like TypeError) you will now get a more helpful error message about this. (before it would say Right-hand side of 'instanceof' is not an object, now it says The instanceof assertion needs a constructor but <type> was given). (#899).

Bug Fixes

  • Minor update deep-eql to 2.0.1 (#871) which fixes bugs around Memoization, and lets comparators override evaluation of primitives.

  • We've updated documentation and error handling around using .length (#897) - which can, in some cases, be problematic. Typically, you'll want to use .lengthOf instead - but the documentation now makes this clear, and errors are more helpful when bad things happen.

  • We've improved stack traces to strip out chai's internals, especially in newer environments which use Proxies (#884 and #922).

  • We've gone through and made sure every assertion honors the custom error message you pass it - some didn't! (#947).

  • getFuncName has had an update since we pulled out the behaviour in 4.0.0-canary.1 (#915). Practically this doesn't change anything in Chai.


  • Added LICENSE file (#854)
  • Major documentation rewrite including the plugin docs (#911), .throw docs (#866), and, well, just about all other docs (#920). These docs are far more detailed now, explaining caveats, algorithms and best practices.

Dependencies for 4.0.0-canary.2

Name Requirement Status










Display all

My projects using chai

Name Locked version Requirement
You should be logged in to see which of your projects use chai.