Skip to content

Releases: chaijs/chai

3.3.0 / 2015-09-08

11 Sep 21:42

Choose a tag to compare

This release adds some new assertions and fixes some quite important, long standing bugs. Here are the cliff notes:

  • Bugfix: Property assertions that fail now show a stack trace!
  • Bugfix: If you've used the frozen, sealed or extensible assertions to test primitives (e.g. expect(1).to.be.frozen), you may have noticed that in older browsers (ES5) these fail, and in new ones (ES6) they pass. They have now been fixed to consistently pass
  • The assert interface has been given the following new methods, to align better with other interfaces:, assert.isAtMost, assert.isAtLeast, assert.isNotTrue, assert.isNotFalse.

Community Contributions

Code Features & Fixes

Documentation fixes

3.2.0 / 2015-07-19

19 Jul 17:02

Choose a tag to compare

This release fixes a bug with the previous additions in 3.1.0. assert.frozen/expect().to.be.frozen/.should.be.frozen all accidentally called Object.isSealed() instead. Now they correctly call Object.isFrozen().

If you're using these features, please upgrade immediately.

It also adds aliases for a lot of assert methods:

  • expect/should..respondTo: respondsTo
  • expect/should..satisfy: satisfies
  • assert.ok: assert.isOk
  • assert.notOk: assert.isNotOk
  • assert.extensible: assert.isExtensible
  • assert.notExtensible: assert.isNotExtensible
  • assert.sealed: assert.isSealed
  • assert.notSealed: assert.isNotSealed
  • assert.frozen: assert.isFrozen
  • assert.notFrozen: assert.isNotFrozen

Community Contributions

Code Features & Fixes

3.1.0 / 2015-07-16

16 Jul 21:06

Choose a tag to compare

This release adds assertions for extensibility/freezing/sealing on objects:

assert.extensible({});
assert.notExtensible(Object.preventExtensions({}));
expect(Object.preventExtensions({})).to.not.be.extensible;
Object.preventExtensions({}).should.not.be.extensible;

assert.notSealed({});
assert.sealed(Object.seal({}));
expect(Object.seal({})).to.be.sealed;
Object.seal({}).should.be.sealed;

assert.notFrozen({});
assert.frozen(Object.freeze({}));
expect(Object.freeze({})).to.be.frozen;
Object.freeze({}).should.be.frozen;

It also adds assertions for checking if a number is NaN:

assert.isNaN(NaN);
assert.isNotNaN(5);
expect(NaN).to.be.NaN;
expect(5).to.not.be.NaN;
NaN.should.be.NaN;
5.should.not.be.NaN;

Community Contributions

Code Features & Fixes

3.0.0 / 2015-06-04

03 Jun 23:27

Choose a tag to compare

This release contains some small breaking changes. Most people are unlikely to
notice them - but here are the breaking changes:

  • Switched from "Component" builds to "Browserify" builds for Browsers. If
    you're using RequireJS with Chai, you might notice a change (chai used to
    be a global, now it won't be - instead you'll have to require it).
  • .has.property('foo', undefined) will now specifically test to make sure
    that the value 'foo' is actually undefined - before it simply tested that
    the key existed (but could have a value).
  • .to.be.a('type') has changed to support more types, including ES6 types
    such as 'promise', 'symbol', 'float32array' etc, this also means using
    ES6's Symbol.toStringTag affects the behaviour .to.be.a(). In addition to
    this, Errors have the type of 'error'.
  • assert.ifError() now follows Node's assert.ifError() behaviour - in other
    words, if the first argument is truthy, it'll throw it.
  • ReleaseNotes.md is no longer maintained, see the Github Releases Page instead.
  • History.md is no longer maintained, see the Github Commit Log instead.

Community Contributions

Code Features & Fixes

Documentation fixes

2.3.0 / 2015-04-26

26 Apr 16:21

Choose a tag to compare

Added ownPropertyDescriptor assertion:

expect('test').to.have.ownPropertyDescriptor('length');
expect('test').to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 });
expect('test').not.to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 });
expect('test').ownPropertyDescriptor('length').to.have.property('enumerable', false);
expect('test').ownPropertyDescriptor('length').to.have.keys('value');

Community Contributions

Code Features & Fixes

Documentation fixes

2.2.0 / 2015-03-26

27 Mar 10:37

Choose a tag to compare

Deep property strings can now be escaped using \\ - for example:

var deepCss = { '.link': { '[target]': 42 }};
expect(deepCss).to.have.deep.property('\\.link.\\[target\\]', 42)

Community Contributions

Code Features & Fixes

Documentation fixes

  • #405 Tweak documentation around
    deep property escaping.
    By @keithamus

2.1.2 / 2015-03-15

15 Mar 21:42

Choose a tag to compare

A minor bug fix. No new features.

Community Contributions

Code Features & Fixes

2.1.1 / 2015-03-04

04 Mar 20:26

Choose a tag to compare

Two minor bugfixes. No new features.

Community Contributions

Code Features & Fixes

  • #385 Fix a bug (also described in
    #387) where deep.property would not work with single
    key names. By @eldritch-fossicker
  • #379 Fix bug where tools which overwrite
    primitive prototypes, such as Babel or core-js would fail.
    By @dcneiner

Documentation fixes

2.1.0 / 2015-02-23

23 Feb 21:42

Choose a tag to compare

Small release; fixes an issue where the Chai lib was incorrectly reporting the
version number.

Adds new should.fail() and expect.fail() methods, which are convenience
methods to throw Assertion Errors.

Community Contributions

Code Features & Fixes

2.0.0 / 2015-02-09

16 Mar 12:48

Choose a tag to compare

Unfortunately with 1.10.0 - compatibility broke with older versions because of
the addChainableNoop. This change has been reverted.

Any plugins using addChainableNoop should cease to do so.

Any developers wishing for this behaviour can use dirty-chai
by @joshperry

Community Contributions

Code Features & Fixes

Documentation fixes