Packages

chai

6.3.0 · 30 Sep 2026MIT222.3M / weekRepositoryHomepagenpmAtom feed

Your version

3.4.0

21 Oct 2015Where it was published

3.5.0 is the newest release of 3.x.

In short

9 new3 fixed1 changed1 internal

Release note

This release improves some confusing error messages, and adds some new assertions. Key points:

  • New assertion: expect(1).oneOf([1,2,3]) - for asserting that a given value is one of a set.

  • .include() (and variants) will now give better error messages for bad object types. Before expect(undefined).to.include(1) would say "expected undefined to include 1", now says "object tested must be an array, an object, or a string but undefined given"

  • .throw() (and variants) can now better determine the Error types, for example expect(foo).to.throw(node_assert.AssertionError) now works.

  • .closeTo is now aliased as .approximately

  • BugFix: .empty changes from 3.3.0 have been reverted, as they caused breaking changes to arrays which manually set keys.

Community Contributions

Code Features & Fixes

  • Checking that argument given to expect is of the right type when using with include.

  • Make chai able to cope with AssertionErrors raised from node's assert.

  • Added approximately alias to close to.

  • expect(inList).to.be.oneOf assertion.

  • Revert .empty assertion change from PR #499.

Documentation fixes

  • Document how the new Error type gets detected by the a/an matcher.

  • Fixes spelling error "everthing" -> "everything".

  • Fix assert lengthOf example.

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.