Packages

chai

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

Your version

1.9.1

19 Mar 2014Where it was published

1.10.0 is the newest release of 1.x.

In short

3 new3 fixed9 changed

Release note

The following changes are required if you are upgrading from the previous version:

  • Users: Migrate configuration options to new interface. (see notes)

  • Plugin Developers:

    • No changes required

  • Core Contributors:

    • Refresh node_modules folder for updated dependencies.

Configuration

There have been requests for changes and additions to the configuration mechanisms
and their impact in the Chai architecture. As such, we have decoupled the
configuration from the Assertion constructor. This not only allows for centralized
configuration, but will allow us to shift the responsibility from the Assertion
constructor to the assert interface in future releases.

These changes have been implemented in a non-breaking way, but a depretiation
warning will be presented to users until they migrate. The old config method will
be removed in either v1.11.0 or v2.0.0, whichever comes first.

Quick Migration

// change this:
chai.Assertion.includeStack = true;
chai.Assertion.showDiff = false;

// ... to this:
chai.config.includeStack = true;
chai.config.showDiff = false;

All Config Options

config.includeStack

User configurable property, influences whether stack trace is included in
Assertion error message. Default of false suppresses stack trace in the error
message.

config.showDiff

User configurable property, influences whether or not the showDiff flag
should be included in the thrown AssertionErrors. false will always be false;
true will be true when the assertion has requested a diff be shown.

config.truncateThreshold (NEW)

User configurable property, sets length threshold for actual and expected values
in assertion errors. If this threshold is exceeded, the value is truncated.

Set it to zero if you want to disable truncating altogether.

chai.config.truncateThreshold = 0; // disable truncating

Community Contributions

Thank you to all who took time to contribute!

Other Bug Fixes

  • Allow undefined for actual. (internal api)

  • Update Karam(+plugins)/Istanbul to most recent versions.

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.