Npms_big

chai

All 72 versions

Version Release date
4.1.2 August 31, 2017

This release fixes a bug when running in certain environments, and includes a few minor documentation fixes.

Bug Fixes

  • fix: update deep-eql to version 3.0.0 (#1020)
  • fix: replace code causing breakage under strict CSP (#1032; @Alhadis)

Docs

  • docs: add missing assert parameters (#1017, #1023; @Hpauric)
  • docs: update year in license file (#1025; @yanca018)
4.1.1 August 05, 2017

This release includes a few bug and documentation fixes.

Bug Fixes

  • fix: .instanceof to allow DOM interfaces in IE11 (#1000, #1008; @meeber)
  • fix: .include to work with all objects (#1009, #1012; @meeber)

Docs

  • fix: correct hasAnyKeys comment error (#1014; @zenHeart)
  • docs: re-indent hasAnyKeys code (#1016; @keithamus)
4.1.0 July 12, 2017

This release includes one new feature and a few bug fixes.

New Features

  • Add ES6 collection support to include() (#970, #994; @shvaikalesh)

Bug Fixes

  • Allow dates for isBelow and isAbove assertions (#980, #990; @v1adko)
  • fix: check target's type in .property assertion (#992; @meeber)

Chores

  • Add a missing var keyword found by lgtm.com (#988; @samlanning)
  • refactor: expectTypes to access ssfi flag (#993; @meeber)
  • Create CODEOWNERS (#1004; @keithamus)
4.0.2 June 05, 2017

We have another bugfix release, addressing some issues for WebPack 1 users.

Bug Fixes

  • Revert getting version information from package.json, some bundler tools like Webpack do not come default with json loaders despite Node being able to handle this. This change moves back to hardcoding the version number in the codebase. (#985, #986)
4.0.1 May 31, 2017

4.0.1

Of course, any major release cannot go without a quick bugfix release shortly after - and here's ours!

Bug Fixes

  • Remove package.json browser field which was mistakenly added, and caused bundler tools like Browserify or Webpack to fail as it attempted to rebundle an already bundled file. (#978, #982)
4.0.0 May 26, 2017

4.0.0

4.0 has been a huge undertaking by the chai community! A lot has changed to ensure Chai 4 is a stable, reliable, well documented codebase. Here are just some of the major improvements:

  • almost all documentation has been rewritten, with detailed instructions on how assertions work, which flags they can be combined with and the best practices for how to use them.

  • deep equality has been rewritten from the ground up to support ES6 types like Map and Set, and better support existing types. It is now also much, much faster than before and allows us to bring some great improvements in upcoming releases.

  • we have made sure the deep flag now only ever does deep equality. Beforehand, it would sometimes also be used to test nested properties (for example expect(foo).to.have.deep.property('bar.baz'). For nested assertions, please now use the .nested flag.

  • many assertions have become more strict, which means you get better error messages explaining where things have gone wrong. For the most part, this wont mean error messages where there weren't error messages before, but it will mean better error messages to replace the, sometimes cryptic, default TypeError messages.

  • we've added detections and helpful error messages for common mistakes and typos. The error messages will, in some cases, point you to documentation or in other cases suggest alternatives. These messages will continue to be improved in future releases, so let us know if you have any suggestions!

Breaking Changes

  • We no longer support Node v0.10 and v0.12 (since their LTS has ended) (PRs: #816, #901)

  • Instead of allowing the user to write the path of a property, now the deep flag performs a deep equality comparison when used with the .property assertion. If you want the old behavior of using the dot or bracket notation to denote the property you want to assert against you can use the new .nested flag. (Related Issues: #745, #743, PRs: #758, #757)

    const obj = {a: 1};
    
    // The `.deep` flag now does deep equality comparisons
    expect({foo: obj}).to.have.deep.property('foo', {a: 1});
    
    // Use the `nested` flag if you want to assert against a nested property using the bracket or dot notation
    expect({foo: obj}).to.have.nested.property('foo.a', 1);
    
    // You can also use both flags combined
    const obj2 = {a: {b: 2}};
    expect({foo: obj2}).to.have.deep.nested.property('foo.a', {b: 2});
    

    Please notice that the old methods which used the old behavior of the deep flag on the assert interface have been renamed. They all have had the deep word changed by the nested word. If you want to know more about this please take a look at #757.

  • Previously, expect(obj).not.property(name, val) would throw an Error if obj didn't have a property named name. This change causes the assertion to pass instead. The assert.propertyNotVal and assert.deepPropertyNotVal assertions were renamed to assert.notPropertyVal and assert.notDeepPropertyVal, respectively. (Related Issues: #16, #743, #758)

  • You can now use the deep flag for the .include assertion in order to perform a deep equality check to see if something is included on the target. Previously, .include was using strict equality (===) for non-negated property inclusion, but deep equality for negated property inclusion and array inclusion. This change causes the .include assertion to always use strict equality unless the deep flag is set. Please take a look at this comment if you want to know more about it. (Related Issues: #743, PRs: #760, #761)

    const obj = {a: 1};
    expect([obj]).to.deep.include({a:1});
    expect({foo: obj}).to.deep.include({foo: {a:1}});
    
  • Fix unstable behavior of the NaN assertion. Now we use the suggested ES6 implementation. The new implementation is now more correct, strict and simple. While the old one threw false positives, the new implementation only checks if something is NaN (or not if the .not flag is used) and nothing else. (Related Issues: #498, #682, #681, PRs: #508)

    // Only `NaN` will be considered to be `NaN` and nothing else
    expect(NaN).to.be.NaN;
    
    // Anything that is not `NaN` cannot be considered as `NaN`
    expect('randomString').not.to.be.NaN;
    expect(true).not.to.be.NaN;
    expect({}).not.to.be.NaN;
    expect(4).not.to.be.NaN;
    
  • The Typed Array types are now truncated if they're too long (in this case, if they exceed the truncateThreshold value on the config). (Related Issues: #441, PRs: #576)

    var arr = [];
    for (var i = 1; i <= 1000; i++) {
      arr.push(i);
    }
    
    // The assertion below will truncate the diff shown and the enormous typed array will be shown as:
    // [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...  ] instead of printing the whole typed array
    chai.expect(new Float32Array(100)).to.equal(1);
    
  • The assertions: within, above, least, below, most, increase, decrease will throw an error if the assertion's target or arguments are not numbers. (Related Issues: #691, PRs: #692, #796)

    // These will throw errors, for example:
    expect(null).to.be.within(0, 1);
    expect(null).to.be.above(10);
    expect(null).to.be.at.least(20);
    expect(null).to.be.below(20);
    expect(null).to.be.at.most(20);
    expect(null).to.increase.by(20);
    expect(null).to.decrease.by(20);
    
    // This will not:
    expect('string').to.have.a.lengthOf.at.least(3);
    
  • Previously, expect(obj).not.ownProperty(name, val) would throw an Error if obj didn't have an own property (non-inherited) named name. This change causes the assertion to pass instead. (Related Issues: #795, #, PRs: #744, #810)*

    expect({ foo: 'baz' }).to.not.have.own.property('quux', 'baz');
    
  • The .empty assertion will now throw when it is passed non-string primitives and functions (PRs: #763, #812)

    // These will throw TypeErrors:
    expect(Symbol()).to.be.empty;
    expect(function() {}).to.be.empty;
    expect(true).to.be.empty;
    expect(1).to.be.empty
    
  • Assertion subject (obj) changes when using ownProperty or own.property and thus enables chaining. (Related Issues: #281, PRs: #641)

    expect({val: 20}).to.have.own.property('val').above(10);
    
  • The .change, .increase, and .decrease assertions changed from chainable method assertions to method assertions. They don't have any chaining behavior, and there's no generic semantic benefit to chaining them. (Related Issues: #917, PRs: #925)

// This will not work anymore because there is no benefit to chaining these assertions:
expect(function() {}).to.change.by(2)
expect(function() {}).to.increase.by(2)
expect(function() {}).to.decrease.by(2)
  • The utils (second argument passed to the chai.use callback function) no longer exports the getPathValue function. If you want to use that please use the pathval module, which is what chai uses internally now. (Related Issues: #457, #737, PRs: #830)

  • (For plugin authors) Throw when calling _superon overwriteMethodif the method being overwritten is undefined. Currently if the method you are trying to overwrite is not defined and your new method calls _super it will throw an Error.(Related Issues: #467, PRs: #528) Before this change, calling _super would simply return this.

    // Considering the method `imaginaryMethod` does not exist, this would throw an error for example:
    chai.use(function (chai, utilities) {
      chai.Assertion.overwriteMethod('imaginaryMethod', function (_super) {
        return function () {
          _super.apply(this, arguments);
        }
      });
    });
    
    // This will throw an error since you are calling `_super` which should be a method (in this case, the overwritten assertion) that does not exist
    expect('anything').to.imaginaryMethod(); 
    
  • (For plugin authors) Now showDiff is turned on by default whenever the showDiff flag is anything other than false. This issue will mostly affect plugin creators or anyone that made extensions to the core, since this affects the Assertion.assert method. (Related Issues: #574, PRs: #515)

    // Now whenever you call `Assertion.assert` with anything that is not false for the `showDiff` flag it will be true
    // The assertion error that was thrown will have the `showDiff` flag turned on since it was not passed to the `assert` method
    try {
      new chai.Assertion().assert(
          'one' === 'two'
        , 'expected #{this} to equal #{exp}'
        , 'expected #{this} to not equal #{act}'
        , 'one'
        , 'two'
      );
    } catch(e) {
      assert.isTrue(e.showDiff);
    }
    
    // The assertion error that was thrown will have the `showDiff` flag turned off since here we passed `false` explicitly
    try {
      new chai.Assertion().assert(
          'one' === 'two'
        , 'expected #{this} to equal #{exp}'
        , 'expected #{this} to not equal #{act}'
        , 'one'
        , 'two'
        , false
      );
    } catch(e) {
      assert.isFalse(e.showDiff);
    }
    

New Features

  • Throw when non-existent property is read. (Related Issues: #407, #766 PRs: #721, #770) This is a potentially breaking change. Your build will fail if you have typos in your property assertions Before 4.x.x when using property assertions they would not throw an error if you wrote it incorrectly. The example below, for example, would pass:

    expect(true).to.be.ture; // Oops, typo, now Chai will throw an Error
    

    Since this implementation depends on ES6 Proxies it will only work on platforms that support it.

    This property can be enabled (default) or disabled through the config.useProxy property, for example:

    chai.config.useProxy = false;  // disable use of Proxy
    
  • Add fix suggestions when accessing a nonexistent property in proxy mode. (Related Issues: #771, PRs: #782) When a nonexistent property is accessed in proxy mode, Chai will compute the levenshtein distance to all possible properties in order to suggest the best fix to the user.

    expect(false).to.be.fals; // Error: Invalid Chai property: fals. Did you mean "false"?
    expect('foo').to.be.undefind; // Error: Invalid Chai property: undefind. Did you mean "undefined"?
    
    // If the Levenshtein distance between the word and any Chai property is greater than 4, no fix will be suggested
    expect('foo').to.be.fdsakfdsafsagsadgagsdfasf // error thrown, no fix suggested
    
  • When non-chainable methods (including overwritten non-chainable methods) are used incorrectly an error will be thrown with a helpful error message. (PRs: #789)

    expect(true).to.equal.true;  // Invalid Chai property: equal.true. See docs for proper usage of "equal".
    
  • Add a new configuration setting that describes which keys will be ignored when checking for non-existing properties on an assertion before throwing an error. Since this implementation depends on ES6 Proxies it will only work on platforms that support it. Also, if you disable config.useProxy, this setting will have no effect. (Related Issues: #765, PRs: #774)

    chai.config.proxyExcludedKeys.push('nonExistingProp');
    
    expect('my string').to.nonExistingProp; // This won't throw an error now
    
  • Add script that registers should as a side-effect. (Related Issues: #594, #693 PRs: #604)

    // You can now write:
    import 'chai/should';
    
    // as opposed to:
    import {should} from 'chai';
    should();
    

    You can also register should via a mocha option: mocha --require chai/should.

  • The change assertion accepts a function as object. (Related Issues: #544, PRs: #607)

    // Now you can also check if the return value of a function changes, for example
    assert.increases(
      someOperation,
      () => getSomething().length
    )
    
  • You can also assert for a delta using the by assertion alongside the change, increase and decrease assertions. (Related Issues: #339, PRs: #621)

// You can use `.by` to assert the amount you want something to change
var obj = { val: 10 };
var increaseByTwo = function() { obj.val += 2 };
var decreaseByTwo = function() { obj.val -= 2 };
var increaseByThree = function() { obj.val += 3 };

expect(increaseByThree).to.change(obj, 'val').by(3);
expect(increaseByTwo).to.increase(obj, 'val').by(2);
expect(decreaseByTwo).to.decrease(obj, 'val').by(2);

// Please notice that if you want to assert something did change but not by some amount you need to use `.not` **after** the `change` related assertion
// Take a look at the examples below:
expect(increaseByThree).to.change(obj, 'val').but.not.by(5)
expect(increaseByTwo).to.increase(obj, 'val').but.not.by(1)
expect(decreaseByTwo).to.decrease(obj, 'val').but.not.by(1)
  • The .keys assertion can now operate on maps and sets. (Related Issues: #632, PRs: #633, #668)
// The `.keys` assertion now works on `map`s and `set`s natively, like the examples below:
expect(new Map([[{objKey: 'value'}, 'value'], [1, 2]])).to.contain.key({objKey: 'value'});
expect(new Map([[{objKey: 'value'}, 'value'], [1, 2]])).to.contain.any.keys([{objKey: 'value'}, {anotherKey: 'anotherValue'}]);
expect(new Map([['firstKey', 'firstValue'], [1, 2]])).to.contain.all.keys('firstKey', 1);
expect(new Set([['foo', 'bar'], ['example', 1]])).to.have.any.keys('foo');

// You can also use `.deep` when asserting agains `Map`s and `Set`s
expect(new Map([[{objKey: 'value'}, 'value'], [1, 2]])).to.contain.any.deep.keys([{objKey: 'value'}, {anotherKey: 'anotherValue'}]);
expect(new Map([['firstKey', 'firstValue'], [1, 2]])).to.contain.all.deep.keys('firstKey', 1);
expect(new Set([['foo', 'bar'], ['example', 1]])).to.have.any.deep.keys('foo');
  • Add compatibility with strict mode. (Related Issues: #578, PRs: #665)

    // This means you can now run your code with the `--use_strict` flag on Node
    // If want to understand more about this please read the issue related to this change
    
  • Add does and but as new no-op assertion. (Related Issues: #700, #339 PRs: #621, #701)

    // You can now write assertions forming phrases with these two new words:
    expect(increaseByThree).to.change(obj, 'val').but.not.by(5);
    expect(foobar).to.have.property("baz").which.does.not.have.property("thing");
    
  • Allow use to be imported using new ES6 module syntax. (Related Issues: #718, PRs: #724)

    // You can now import `use` using the ES6 module syntax, like the example below:
    import sinonChai from "sinon-chai";
    import {expect, use} from "chai";
    
    use(sinonChai);
    

    You can also use require alongside the new ES6 destructuring feature:

    const sinonChai = require('sinon-chai');
    const {expect, use} = require("chai");
    
    use(sinonChai);
    
  • Add ordered flag for members assertion. (Related Issues: #717, PRs: #728)

    // You can now use the `ordered` flag to assert the order of elements when using the `members` assertion:
    expect([1, 2, 3]).to.include.ordered.members([1, 2]); // This passes
    expect([1, 2, 3]).to.include.ordered.members([2, 3]); // This will fail! Read the docs to know more.
    
  • Add .own flag to .property assertion. It does the same thing as .ownProperty and cannot be used alongisde the new .nested flag. (Related Issues: #795, PRs: #810)

    expect({a: 1}).to.have.own.property('a');
    
    // The example below will thrown an Error
    expect({a: {b: 1}}).to.have.own.nested.property('a.b', 1);
    
  • Add .deep support to .property assertion. (Related Issues: #795, PRs: #810)

    expect({ foo: { bar: 'baz' } }).to.have.deep.own.property('foo', { bar: 'baz' });
    expect({ foo: { bar: { baz: 'quux' } } }).to.have.deep.nested.property('foo.bar', { baz: 'quux' });
    
  • The .empty assertion will now work with ES6 collections (PRs: #763, #812, #814) Please notice that this assertion will throw an error when it is passed a WeakMap or WeakSet.

    expect(new Set()).to.be.empty;
    expect(new Map()).to.be.empty;
    
    // The examples below will throw a TypeError:
    expect(new WeakSet()).to.be.empty;
    expect(new WeakMap()).to.be.empty;
    
  • Add script that registers should as a side-effect. This change allows you to register should via a mocha option by using: mocha spec.js -r chai/register-should and also allows you to register the testing style globally. (Issues: #693, PRs: #868)

    require('chai/register-should');  // Using Should style
    
  • Add script that registers assert as a side-effect. This change allows you to register assert via a mocha option by using: mocha spec.js -r chai/register-assert (Issues: #693, PRs: #868, #872)

require('chai/register-assert');  // Using Assert style
  • Add script that registers expect as a side-effect. This change allows you to register expect via a mocha option by using: mocha spec.js -r chai/register-expect (Issues: #693, PRs: #868, #872)

    require('chai/register-expect');  // Using Expect style
    
  • When the length assertion is chained directly off of an uninvoked method, it references function's built-in length property instead of Chai's length assertion. This commit adds a guard to Chai methods to detect this problem and throw a helpful error message that advises the user on how to correct it. (Issues: #684, #841, PRs: #897)

  • Allows the lockSsfi flag to be set when creating new Assertion. This flag controls whether or not the given ssfi flag should retain its current value, even as assertions are chained off of this object. This is usually set to true when creating a new assertion from within another assertion. It's also temporarily set to true before an overwritten assertion gets called by the overwriting assertion. (Issues: #878, #904, PRs: #922)

    // This will lock the stack stack function from this line on
    // The SSFI is the reference to the starting point for removing irrelevant frames from the stack trace
    new Assertion(obj, msg, ssfi, true).to.have.property('length')
    
  • The nestedInclude, deepNestedInclude, ownInclude and deepOwnInclude assertions and there negated pairs were added to the assert interface. (Issues: #905, PRs: #964)

    // '[]' and '.' in property names can be escaped using double backslashes.
    
    assert.nestedInclude({'.a': {'b': 'x'}}, {'\\.a.[b]': 'x'});
    assert.notNestedInclude({'.a': {'b': 'x'}}, {'\\.a.b': 'y'});
    
    assert.deepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {x: 1}});
    assert.notDeepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {y: 1}});
    
    assert.ownInclude({ a: 1 }, { a: 1 });
    assert.notOwnInclude({ a: 1 }, { b: 2 });
    
    assert.deepOwnInclude({a: {b: 2}}, {a: {b: 2}});
    assert.notDeepOwnInclude({a: {b: 2}}, {a: {c: 3}});
    

Bug Fixes

  • Fix missing msg argument for change related assertions. (Related Issues: None, PRs: #606)
  • The addMethod function returns a new assertion with flags copied over instead of this. (Related Issues: #562, #684, #723, PRs: #642, #660)
  • Fix stacktraces for overwritten properties and methods. (Related Issues: #659, #661)
  • Fix bug when testing Symbol equality with should syntax. (Related Issues: #669, PRs: #672)
  • Fix bug when asserting some valid ES6 keys. (Related Issues: #674, PRs: #676)
  • Fix bug caused when custom inspect method is used and this method calls stylize. (PRs: #680)
  • Fix ownProperty on objects with no prototype. (Related Issues: #688, PRs: #689)
  • Fix swapped expected and actual results for the .members assertion. (Related Issues: #511, PRs: #702)
  • Fix same.members to properly handle duplicates by treating each one as a unique member. (Related Issues: #590, PRs: #739)
  • Fix deep.have.same.members() that was not printing a diff. (PRs: #509)
  • Diff will be shown for assert's equal and notEqual methods. (Related Issues: #790, PRs: #794)
  • The overwriteMethod, overwriteProperty, addChainableMethod, overwriteChainableMethod functions will return new assertion with flags copied over instead of this. (Related Issues: #562, #642, #791, PRs: #799)
  • Proxy-related implementation frames were showing up in the stack traces for failed property assertions. Now we remove them by setting the proxy getter (instead of the property getter) as the starting point to remove all implementation frames. (PRs: #884)
  • Negated keys assertions will now consider size of sets. (Related Issues: #919, PRs: #924)
  • Whenever passed something that is not an instance of a function, the instanceof assertion will now throw an error informing the user that he should pass a constructor to this assertion, but instead he has passed . (Related Issues: #893, PRs: #924)
  • Fix all issues on expect/should interfaces that were causing implementation frames to leak through. Also improve the internal Chai error test helper to validate stack traces. (Issues: #878, #904, PRs: #922)
  • This fixes custom messages not always being respected. (Issues: #922, #947, #904, PRs: #916, #923)
  • Fix PhantomJS 1.x incompatibility (Issues: #966, PRs: #890)
4.0.0-canary.2 April 17, 2017

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.

Documentation

  • 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.
4.0.0-canary.1 October 24, 2016

4.0.0-canary.1

Breaking Changes

  • Instead of allowing the user to write the path of a property, now the deep flag performs a deep equality comparison when used with the .property assertion. If you want the old behavior of using the dot or bracket notation to denote the property you want to assert against you can use the new .nested flag. (Related Issues: #745, #743, PRs: #758, #757)

    const obj = {a: 1};
    
    // The `.deep` flag now does deep equality comparisons
    expect({foo: obj}).to.have.deep.property('foo', {a: 1});
    
    // Use the `nested` flag if you want to assert against a nested property using the bracket or dot notation
    expect({foo: obj}).to.have.nested.property('foo.a', 1);
    
    // You can also use both flags combined
    const obj2 = {a: {b: 2}};
    expect({foo: obj2}).to.have.deep.nested.property('foo.a', {b: 2});
    

    Please notice that the old methods which used the old behavior of the deep flag on the assert interface have been renamed. They all have had the deep word changed by the nested word. If you want to know more about this please take a look at #757.

  • Previously, expect(obj).not.property(name, val) would throw an Error if obj didn't have a property named name. This change causes the assertion to pass instead. The assert.propertyNotVal and assert.deepPropertyNotVal assertions were renamed to assert.notPropertyVal and assert.notDeepPropertyVal, respectively. (Related Issues: #16, #743, #758)

  • You can now use the deep flag for the .include assertion in order to perform a deep equality check to see if something is included on the target. Previously, .include was using strict equality (===) for non-negated property inclusion, but deep equality for negated property inclusion and array inclusion. This change causes the .include assertion to always use strict equality unless the deep flag is set. Please take a look at this comment if you want to know more about it. (Related Issues: #743, PRs: #760, #761)

    const obj = {a: 1};
    expect([obj]).to.deep.include({a:1});
    expect({foo: obj}).to.deep.include({foo: {a:1}});
    
  • Fix unstable behavior of the NaN assertion. Now we use the suggested ES6 implementation. The new implementation is now more correct, strict and simple. While the old one threw false positives, the new implementation only checks if something is NaN (or not if the .not flag is used) and nothing else. (Related Issues: #498, #682, #681, PRs: #508)

    // Only `NaN` will be considered to be `NaN` and nothing else
    expect(NaN).to.be.NaN;
    
    // Anything that is not `NaN` cannot be considered as `NaN`
    expect('randomString').not.to.be.NaN;
    expect(true).not.to.be.NaN;
    expect({}).not.to.be.NaN;
    expect(4).not.to.be.NaN;
    
  • Throw when calling _superon overwriteMethodif the method being overwritten is undefined. Currently if the method you are trying to overwrite is not defined and your new method calls _super it will throw an Error.(Related Issues: #467, PRs: #528) Before this change, calling _super would simply return this.

    // Considering the method `imaginaryMethod` does not exist, this would throw an error for example:
    chai.use(function (chai, utilities) {
      chai.Assertion.overwriteMethod('imaginaryMethod', function (_super) {
        return function () {
          _super.apply(this, arguments);
        }
      });
    });
    
    // This will throw an error since you are calling `_super` which should be a method (in this case, the overwritten assertion) that does not exist
    expect('anything').to.imaginaryMethod(); 
    
  • Now showDiff is turned on by default whenever the showDiff flag is anything other than false. This issue will mostly affect plugin creators or anyone that made extensions to the core, since this affects the Assertion.assert method. (Related Issues: #574, PRs: #515)

    // Now whenever you call `Assertion.assert` with anything that is not false for the `showDiff` flag it will be true
    // The assertion error that was thrown will have the `showDiff` flag turned on since it was not passed to the `assert` method
    try {
      new chai.Assertion().assert(
          'one' === 'two'
        , 'expected #{this} to equal #{exp}'
        , 'expected #{this} to not equal #{act}'
        , 'one'
        , 'two'
      );
    } catch(e) {
      assert.isTrue(e.showDiff);
    }
    
    // The assertion error that was thrown will have the `showDiff` flag turned off since here we passed `false` explicitly
    try {
      new chai.Assertion().assert(
          'one' === 'two'
        , 'expected #{this} to equal #{exp}'
        , 'expected #{this} to not equal #{act}'
        , 'one'
        , 'two'
        , false
      );
    } catch(e) {
      assert.isFalse(e.showDiff);
    }
    
  • The Typed Array types are now truncated if they're too long (in this case, if they exceed the truncateThreshold value on the config). (Related Issues: #441, PRs: #576)

    var arr = [];
    for (var i = 1; i <= 1000; i++) {
      arr.push(i);
    }
    
    // The assertion below will truncate the diff shown and the enourmous typed array will be shown as:
    // [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...  ] instead of printing the whole typed array
    chai.expect(new Float32Array(100)).to.equal(1);
    
  • The assertions: within, above, least, below, most, increase, decrease will throw an error if the assertion's target or arguments are not numbers. (Related Issues: #691, PRs: #692, #796)

    // These will throw errors, for example:
    expect(null).to.be.within(0, 1);
    expect(null).to.be.above(10);
    expect(null).to.be.at.least(20);
    expect(null).to.be.below(20);
    expect(null).to.be.at.most(20);
    expect(null).to.increase.by(20);
    expect(null).to.decrease.by(20);
    
    // This will not:
    expect('string').to.have.a.length.of.at.least(3);
    
  • Previously, expect(obj).not.ownProperty(name, val) would throw an Error if obj didn't have an own property (non-inherited) named name. This change causes the assertion to pass instead. (Related Issues: #795, #, PRs: #744, #810)*

    expect({ foo: 'baz' }).to.not.have.own.property('quux', 'baz');
    
  • The .empty assertion will now throw when it is passed non-string primitives and functions (PRs: #763, #812)

    // These will throw TypeErrors:
    expect(Symbol()).to.be.empty;
    expect(function() {}).to.be.empty;
    expect(true).to.be.empty;
    expect(1).to.be.empty
    
  • Assertion subject (obj) changes when using ownProperty or own.property and thus enables chaining. (Related Issues: #281, PRs: #641)

    expect({val: 20}).to.have.own.property('val').above(10);
    
  • The utils (second argument passed to the chai.use callback function) no longer exports the getPathValue function. If you want to use that please use the pathval module, which is what chai uses internally now. (Related Issues: #457, #737, PRs: #830)

New Features

  • Throw when non-existent property is read. (Related Issues: #407, #766 PRs: #721, #770) This is a potentially breaking change. Your build will fail if you have typos in your property assertions Before 4.x.x when using property assertions they would not throw an error if you wrote it incorrectly. The example below, for example, would pass:

    expect(true).to.be.ture; // Oops, typo, now Chai will throw an Error
    

    Since this implementation depends on ES6 Proxies it will only work on platforms that support it.

    This property can be enabled (default) or disabled through the config.useProxy property, for example:

    chai.config.useProxy = false;  // disable use of Proxy
    
  • Add fix suggestions when accessing a nonexistent property in proxy mode. (Related Issues: #771, PRs: #782) When a nonexistent property is accessed in proxy mode, Chai will compute the levenshtein distance to all possible properties in order to suggest the best fix to the user.

    expect(false).to.be.fals; // Error: Invalid Chai property: fals. Did you mean "false"?
    expect('foo').to.be.undefind; // Error: Invalid Chai property: undefind. Did you mean "undefined"?
    
    // If the Levenshtein distance between the word and any Chai property is greater than 4, no fix will be suggested
    expect('foo').to.be.fdsakfdsafsagsadgagsdfasf // error thrown, no fix suggested
    
  • When non-chainable methods (including overwritten non-chainable methods) are used incorrectly an error will be thrown with a helpful error message. (PRs: #789)

    expect(true).to.equal.true;  // Invalid Chai property: equal.true. See docs for proper usage of "equal".
    
  • Add a new configuration setting that describes which keys will be ignored when checking for non-existing properties on an assertion before throwing an error. Since this implementation depends on ES6 Proxies it will only work on platforms that support it. Also, if you disable config.useProxy, this setting will have no effect. *(Related Issues: #765, PRs: #774)

    chai.config.proxyExcludedKeys.push('nonExistingProp');
    
    expect('my string').to.nonExistingProp; // This won't throw an error now
    
  • Add script that registers should as a side-effect. (Related Issues: #594, #693 PRs: #604)

    // You can now write:
    import 'chai/should';
    
    // as opposed to:
    import {should} from 'chai';
    should();
    

    You can also register should via a mocha option: mocha --require chai/should.

  • The change assertion accepts a function as object. (Related Issues: #544, PRs: #607)

    // Now you can also check if the return value of a function changes, for example
    assert.increases(
      someOperation,
      () => getSomething().length
    )
    
  • You can also assert for a delta using the by assertion alongside the change, increase and decrease assertions. (Related Issues: #339, PRs: #621)

// You can use `.by` to assert the amount you want something to change
var obj = { val: 10 };
var increaseByTwo = function() { obj.val += 2 };
var decreaseByTwo = function() { obj.val -= 2 };
var increaseByThree = function() { obj.val += 3 };

expect(increaseByThree).to.change(obj, 'val').by(3);
expect(increaseByTwo).to.increase(obj, 'val').by(2);
expect(decreaseByTwo).to.decrease(obj, 'val').by(2);

// Please notice that if you want to assert something did change but not by some amount you need to use `.not` **after** the `change` related assertion
// Take a look at the examples below:
expect(increaseByThree).to.change(obj, 'val').but.not.by(5)
expect(increaseByTwo).to.increase(obj, 'val').but.not.by(1)
expect(decreaseByTwo).to.decrease(obj, 'val').but.not.by(1)
  • The .keys assertion can now operate on maps and sets. (Related Issues: #632, PRs: #633, #668)
// The `.keys` assertion now works on `map`s and `set`s natively, like the examples below:
expect(new Map([[{objKey: 'value'}, 'value'], [1, 2]])).to.contain.key({objKey: 'value'});
expect(new Map([[{objKey: 'value'}, 'value'], [1, 2]])).to.contain.any.keys([{objKey: 'value'}, {anotherKey: 'anotherValue'}]);
expect(new Map([['firstKey', 'firstValue'], [1, 2]])).to.contain.all.keys('firstKey', 1);
expect(new Set([['foo', 'bar'], ['example', 1]])).to.have.any.keys('foo');

// You can also use `.deep` when asserting agains `Map`s and `Set`s
expect(new Map([[{objKey: 'value'}, 'value'], [1, 2]])).to.contain.any.deep.keys([{objKey: 'value'}, {anotherKey: 'anotherValue'}]);
expect(new Map([['firstKey', 'firstValue'], [1, 2]])).to.contain.all.deep.keys('firstKey', 1);
expect(new Set([['foo', 'bar'], ['example', 1]])).to.have.any.deep.keys('foo');
  • Add compatibility with strict mode. (Related Issues: #578, PRs: #665)

    // This means you can now run your code with the `--use_strict` flag on Node
    // If want to understand more about this please read the issue related to this change
    
  • Add does and but as new no-op assertion. (Related Issues: #700, #339 PRs: #621, #701)

    // You can now write assertions forming phrases with these two new words:
    expect(increaseByThree).to.change(obj, 'val').but.not.by(5);
    expect(foobar).to.have.property("baz").which.does.not.have.property("thing");
    
  • Allow use to be imported using new ES6 module syntax. (Related Issues: #718, PRs: #724)

    // You can now import `use` using the ES6 module syntax, like the example below:
    import sinonChai from "sinon-chai";
    import {expect, use} from "chai";
    
    use(sinonChai);
    

    You can also use require alongside the new ES6 destructuring feature:

    const sinonChai = require('sinon-chai');
    const {expect, use} = require("chai");
    
    use(sinonChai);
    
  • Add ordered flag for members assertion. (Related Issues: #717, PRs: #728)

    // You can now use the `ordered` flag to assert the order of elements when using the `members` assertion:
    expect([1, 2, 3]).to.include.ordered.members([1, 2]); // This passes
    expect([1, 2, 3]).to.include.ordered.members([2, 3]); // This will fail! Read the docs to know more.
    
  • Add .own flag to .property assertion. It does the same thing as .ownProperty and cannot be used alongisde the new .nested flag. (Related Issues: #795, PRs: #810)

    expect({a: 1}).to.have.own.property('a');
    
    // The example below will thrown an Error
    expect({a: {b: 1}}).to.have.own.nested.property('a.b', 1);
    
  • Add .deep support to .property assertion. (Related Issues: #795, PRs: #810)

    expect({ foo: { bar: 'baz' } }).to.have.deep.own.property('foo', { bar: 'baz' });
    expect({ foo: { bar: { baz: 'quux' } } }).to.have.deep.nested.property('foo.bar', { baz: 'quux' });
    
  • The .empty assertion will now work with ES6 collections (PRs: #763, #812, #814) Please notice that this assertion will throw an error when it is passed a WeakMap or WeakSet.

    expect(new Set()).to.be.empty;
    expect(new Map()).to.be.empty;
    
    // The examples below will throw a TypeError:
    expect(new WeakSet()).to.be.empty;
    expect(new WeakMap()).to.be.empty;
    

Bug Fixes

  • Fix missing msg argument for change related assertions. (Related Issues: None, PRs: #606)
  • The addMethod function returns a new assertion with flags copied over instead of this. (Related Issues: #562, #684, #723, PRs: #642, #660)
  • Fix stacktraces for overwritten properties and methods. (Related Issues: #659, #661)
  • Fix bug when testing Symbol equality with should syntax. (Related Issues: #669, PRs: #672)
  • Fix bug when asserting some valid ES6 keys. (Related Issues: #674, PRs: #676)
  • Fix bug caused when custom inspect method is used and this method calls stylize. (PRs: #680)
  • Fix ownProperty on objects with no prototype. (Related Issues: #688, PRs: #689)
  • Fix swapped expected and actual results for the .members assertion. (Related Issues: #511, PRs: #702)
  • Fix same.members to properly handle duplicates by treating each one as a unique member. (Related Issues: #590, PRs: #739)
  • Fix deep.have.same.members() that was not printing a diff. (PRs: #509)
  • Diff will be shown for assert's equal and notEqual methods. (Related Issues: #790, PRs: #794)
  • The overwriteMethod, overwriteProperty, addChainableMethod, overwriteChainableMethod functions will return new assertion with flags copied over instead of this. (Related Issues: #562, #642, #791, PRs: #799)
3.5.0 January 28, 2016

For assert fans: you now have assert.includeDeepMembers() which matches expect().to.include.deep.members() and .should.include.deep.members()!

This release also includes a variety of small bugfixes and documentation fixes. Most notably, we are now governed by a Code Of Conduct - which gives Chai contributors (including those who files issues, work on code, or documentation, or even just hang out on our Slack & Gitter channels) safety from harassment and discrimination.

Full changes below:

Community Contributions

Documentation fixes

3.4.1 November 07, 2015

This is a small documentation bug fix release - it just fixes a couple of issues with the documentation.

Community Contributions

Documentation fixes

3.4.0 October 21, 2015

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

  • Feature: New assertion: expect(1).oneOf([1,2,3]) - for asserting that a given value is one of a set.
  • Feature: .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"
  • Feature: .throw() (and variants) can now better determine the Error types, for example expect(foo).to.throw(node_assert.AssertionError) now works.
  • Feature: .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

  • #503 Checking that argument given to expect is of the right type when using with include. By @astorije
  • #446 Make chai able to cope with AssertionErrors raised from node's assert. By @danielbprice
  • #527 Added approximately alias to close to. By @danielbprice
  • #534 expect(inList).to.be.oneOf assertion. By @Droogans
  • #538 Revert .empty assertion change from PR #499. By @tusbar

Documentation fixes

3.3.0 September 21, 2015

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 July 19, 2015

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 July 16, 2015

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 June 03, 2015

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 April 26, 2015

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 March 27, 2015

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 March 15, 2015

A minor bug fix. No new features.

Community Contributions

Code Features & Fixes

2.1.1 March 04, 2015

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 February 23, 2015

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 February 11, 2015

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

1.10.0 November 10, 2014

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

  • Users:
    • No changes required
  • Plugin Developers:
    • Review addChainableNoop notes below.
  • Core Contributors:
    • Refresh node_modules folder for updated dependencies.

Noop Function for Terminating Assertion Properties

The following assertions can now also be used in the function-call form:

  • ok
  • true
  • false
  • null
  • undefined
  • exist
  • empty
  • arguments
  • Arguments

The above list of assertions are property getters that assert immediately on access. Because of that, they were written to be used by terminating the assertion chain with a property access.

expect(true).to.be.true;
foo.should.be.ok;

This syntax is definitely aesthetically pleasing but, if you are linting your test code, your linter will complain with an error something like "Expected an assignment or function call and instead saw an expression." Since the linter doesn't know about the property getter it assumes this line has no side-effects, and throws a warning in case you made a mistake.

Squelching these errors is not a good solution as test code is getting to be just as important as, if not more than, production code. Catching syntactical errors in tests using static analysis is a great tool to help make sure that your tests are well-defined and free of typos.

A better option was to provide a function-call form for these assertions so that the code's intent is more clear and the linters stop complaining about something looking off. This form is added in addition to the existing property access form and does not impact existing test code.

expect(true).to.be.true();
foo.should.be.ok();

These forms can also be mixed in any way, these are all functionally identical:

expect(true).to.be.true.and.not.false();
expect(true).to.be.true().and.not.false;
expect(true).to.be.true.and.not.false;

Plugin Authors

If you would like to provide this function-call form for your terminating assertion properties, there is a new function to register these types of asserts. Instead of using addProperty to register terminating assertions, simply use addChainableNoop instead; the arguments to both are identical. The latter will make the assertion available in both the attribute and function-call forms and should have no impact on existing users of your plugin.

Community Contributions

Thank you to all who took time to contribute!

1.9.2 September 29, 2014

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

  • Users:
    • No changes required
  • Plugin Developers:
    • No changes required
  • Core Contributors:
    • Refresh node_modules folder for updated dependencies.

Community Contributions

Thank you to all who took time to contribute!

1.9.1 March 19, 2014

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
  • @param {Boolean}
  • @default false

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
  • @param {Boolean}
  • @default true

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)
  • @param {Number}
  • @default 40

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

  • #183 Allow undefined for actual. (internal api)
  • Update Karam(+plugins)/Istanbul to most recent versions.
1.9.0 January 29, 2014

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

  • Users:
    • No changes required
  • Plugin Developers:
  • Core Contributors:
    • Refresh node_modules folder for updated dependencies.

Community Contributions

Thank you to all who took time to contribute!

Other Bug Fixes

  • #225 Improved AMD wrapper provided by upstream component(1).
  • #185 assert.throws() returns thrown error for further assertions.
  • #237 Remove coveralls/jscoverage, include istanbul coverage report in travis test.
  • Update Karma and Sauce runner versions for consistent CI results. No more karma@canary.
1.8.1 October 10, 2013
  • pkg: update deep-eql version
1.8.0 September 18, 2013
  • test: [sauce] add a few more browsers
  • Merge branch 'refactor/deep-equal'
  • util: remove embedded deep equal utility
  • util: replace embedded deep equal with external module
  • Merge branch 'feature/karma'
  • docs: add sauce badge to readme [ci skip]
  • test: [sauce] use karma@canary to prevent timeouts
  • travis: only run on node 0.10
  • test: [karma] use karma phantomjs runner
  • Merge pull request #181 from tricknotes/fix-highlight
  • Fix highlight for example code
1.7.2 June 27, 2013
  • coverage: add coveralls badge
  • test: [coveralls] add coveralls api integration. testing travis-ci integration
  • Merge branch 'master' of github.com:chaijs/chai
  • Merge branch 'feature/bower'
  • Merge pull request #180 from tricknotes/modify-method-title
  • Merge pull request #179 from tricknotes/highlight-code-example
  • Modify method title to include argument name
  • Fix to highlight code example
  • bower: granular ignores
1.7.1 June 24, 2013
  • Merge branch 'feature/bower'. #175
  • bower: add json file
  • build: browser
1.7.0 June 17, 2013
  • error: remove internal assertion error constructor
  • core: [assertion-error] replace internal assertion error with dep
  • deps: add chaijs/assertion-error@1.0.0
  • docs: fix typo in source file. #174
  • Merge pull request #174 from piecioshka/master
  • typo
  • Merge branch 'master' of github.com:chaijs/chai
  • pkg: lock mocha/mocha-phantomjs versions (for now)
  • Merge pull request #173 from chaijs/inspect-fix
  • Fix utils.inspect with custom object-returning inspect()s.
  • Merge pull request #171 from Bartvds/master
  • replaced tabs with 2 spaces
  • added assert.notOk()
  • Merge pull request #169 from katsgeorgeek/topics/master
  • Fix comparison objects.
1.6.1 June 05, 2013
  • Merge pull request #168 from katsgeorgeek/topics/master
  • Add test for different RegExp flags.
  • Add test for regexp comparison.
  • Downgrade mocha version for fix running Phantom tests.
  • Fix comparison equality of two regexps.
  • Merge pull request #161 from brandonpayton/master
  • Fix documented name for assert interfaces isDefined method
1.6.0 April 30, 2013
  • build: browser
  • assert: [(not)include] throw on incompatible haystack. Closes #142
  • assert: [notInclude] add assert.notInclude. Closes #158
  • browser build
  • makefile: force browser build on browser-test
  • makefile: use component for browser build
  • core: [assertions] remove extraneous comments
  • Merge branch 'master' of github.com:chaijs/chai
  • test: [assert] deep equal ordering
  • Merge pull request #153 from NickHeiner/array-assertions
  • giving members a no-flag assertion
  • Code review comments - changing syntax
  • Code review comments
  • Adding members and memberEquals assertions for checking for subsets and set equality. Implements chaijs/chai#148.
  • Merge pull request #140 from RubenVerborgh/function-prototype
  • Restore the call and apply methods of Function when adding a chainable method.
  • readme: 2013
  • notes: migration notes for deep equal changes
  • test: for ever err() there must be a passing version
1.5.0 February 04, 2013
  • docs: add Release Notes for non-gitlog summary of changes.
  • lib: update copyright to 2013
  • Merge branch 'refactor/travis'
  • makefile: remove test-component for full test run
  • pkg: script test now runs make test so travis will test browser
  • browser: build
  • tests: refactor some tests to support new objDisplay output
  • test: [bootstrap] normalize boostrap across all test scenarios
  • assertions: refactor some assertions to use objDisplay instead of inspect
  • util: [objDisplay] normalize output of functions
  • makefile: refactor for full build scenarios
  • component: fix build bug where missing util:type file
  • assertions: [throw] code cleanup
  • Merge branch 'refactor/typeDetection'
  • browser: build
  • makefile: chai.js is .PHONY so it builds every time
  • test: [expect] add arguments type detection test
  • core/assertions: [type] (a/an) refactor to use type detection utility
  • util: add cross-browser type detection utility
  • Merge branch 'feature/component'
  • browser: build
  • component: add component.json file
  • makefile: refactor for fine grain control of testing scenarios
  • test: add mochaPhantomJS support and component test file
  • deps: add component and mocha-phantomjs for browser testing
  • ignore: update ignore files for component support
  • travis: run for all branches
  • Merge branch 'feature/showDiff'
  • test: [Assertion] configruable showDiff flag. Closes #132
  • lib: [Assertion] add configurable showDiff flag. #132
  • Merge branch 'feature/saucelabs'
  • Merge branch 'master' into feature/saucelabs
  • browser: build
  • support: add mocha cloud runner, client, and html test page
  • test: [saucelabs] add auth placeholder
  • deps: add mocha-cloud
  • Merge pull request #136 from whatthejeff/message_fix
  • Merge pull request #138 from timnew/master
  • Fix issue #137, test message existence by using message!=null rather than using message
  • Fixed backwards negation messages.
  • Merge pull request #133 from RubenVerborgh/throw
  • Functions throwing strings can reliably be tested.
  • Merge pull request #131 from RubenVerborgh/proto
  • Cache whether proto is supported.
  • Use proto if available.
  • Determine the property names to exclude beforehand.
  • Merge pull request #126 from RubenVerborgh/eqls
  • Add alias eqls for eql.
  • Use inherited enumerable properties in deep equality comparison.
  • Show inherited properties when inspecting an object.
  • Add new getProperties and getEnumerableProperties utils.
  • showDiff: force true for equal and eql
1.4.2 December 21, 2012
  • browser build: (object diff support when used with mocha) #106
  • test: [display] array test for mocha object diff
  • browser: no longer need different AssertionError constructor
1.4.1 December 21, 2012
  • showDiff: force diff for equal and eql. #106
  • test: [expect] type null. #122
  • Merge pull request #115 from eshao/fix-assert-Throw
  • FIX: assert.Throw checks error type/message
  • TST: assert.Throw should check error type/message
1.4.0 November 29, 2012
  • pre-release browser build
  • clean up index.js to not check for cov, revert package.json to use index.js
  • convert tests to use new bootstrap
  • refactor testing bootstrap
  • use spaces (not tabs). Clean up #114
  • Merge pull request #114 from trantorLiu/master
  • Add most() (alias: lte) and least() (alias: gte) to the API with new chainers "at" and "of".
  • Change main to ./lib/chai. Fixes #28.
  • Merge pull request #104 from connec/deep_equals_circular_references_
  • Merge pull request #109 from nnarhinen/patch-1
  • Check for 'actual' type
  • Added support for circular references when checking deep (in)equality.
1.3.0 October 01, 2012
  • browser build w/ folio >= 0.3.4. Closes #99
  • add back buffer test for deep equal
  • do not write flags to assertion.prototype
  • remove buffer test from expect
  • browser build
  • improve documentation of custom error messages
  • Merge branch 'master' of git://github.com/Liffft/chai into Liffft-master
  • browser build
  • improved buffer deep equal checking
  • mocha is npm test command
  • Cleaning up the js style???
  • expect tests now include message pass-through
  • packaging up browser-side changes???
  • Increasing Throws error message verbosity
  • Should syntax: piping message through
  • Make globalShould test work in browser too.
  • Add a setter for Object.prototype.should. Closes #86.
1.2.0 August 07, 2012
  • Merge branch 'feature/errmsg'
  • browser build
  • comment updates for utilities
  • tweak objDislay to only kick in if object inspection is too long
  • Merge branch 'master' into feature/errmsg
  • add display sample for error message refactor
  • first draft of error message refactor. #93
  • add closeTo assertion to assert interface. Closes #89.
  • update folio build for better require.js handling. Closes #85
  • Merge pull request #92 from paulmillr/topics/add-dom-checks
  • Add check for DOM objects.
  • browser build
  • Merge branch 'master' of github.com:chaijs/chai
  • bug - getActual not defaulting to assertion subject
  • Merge pull request #88 from pwnall/master
  • Don't inspect() assertion arguments if the assertion passes.
1.1.1 July 09, 2012
  • improve commonjs support on browser build
  • Merge pull request #83 from tkazec/equals
  • Document .equals
  • Add .equals as an alias of .equal
  • remove unused browser prefix/suffix
  • Merge branch 'feature/folio-build'
  • browser build
  • using folio to compile
  • clean up makefile
  • early folio 0.3.x support
1.1.0 June 26, 2012
  • browser build
  • Disable "Assertion.includeStack is false" test in IE.
  • Use utils.getName for all function inspections.
  • Merge pull request #80 from kilianc/closeTo
  • fixes #79
  • browser build
  • expand docs to indicate change of subject for chaining. Closes #78
  • add that chain noop
  • Merge branch 'bug/74'
  • comments on how to property use length as chain. Closes #74
  • tests for length as chainable property. #74
  • add support for length as chainable prop/method.
  • Merge branch 'bug/77'
  • tests for getPathValue when working with nested arrays. Closes #77
  • add getPathValue support for nested arrays
  • browser build
  • fix bug for missing browser utils
  • compile tool aware of new folder layout
  • Merge branch 'refactor/1dot1'
  • move core assertions to own file and refactor all using utils
  • rearrange folder structure
1.0.4 June 03, 2012
  • Merge pull request #68 from fizker/itself
  • Added itself chain.
  • simplify error inspections for cross browser compatibility
  • fix safari addChainableMethod errors. Closes #69
1.0.3 May 27, 2012
  • Point Travis badge to the right place.
  • Make error message for eql/deep.equal more clear.
  • Fix .not.deep.equal.
  • contributors list
1.0.2 May 27, 2012
  • Merge pull request #67 from chaijs/chaining-and-flags
  • Browser build.
  • Use addChainableMethod to get away from __proto__ manipulation.
  • New addChainableMethod utility.
  • Replace getAllFlags with transferFlags utility.
  • browser build
  • test - get all flags
  • utility - get all flags
  • Add .mailmap to .npmignore.
  • Add a .mailmap file to fix my name in shortlogs.
1.0.1 May 18, 2012
  • browser build
  • Fixing "an" vs. "a" grammar in type assertions.
  • Uniformize assert interface inline docs.
  • Don't use instanceof for assert.isArray.
  • Add deep flag for equality and property value.
  • Merge pull request #64 from chaijs/assertion-docs
  • Uniformize assertion inline docs.
  • Add npm-debug.log to .gitignore.
  • no reserved words as actuals. #62
1.0.0 May 15, 2012
  • readme cleanup
  • browser build
  • utility comments
  • removed docs
  • update to package.json
  • docs build
  • comments / docs updates
  • plugins app cleanup
  • Merge pull request #61 from joliss/doc
  • Fix and improve documentation of assert.equal and friends
  • browser build
  • doc checkpoint - texture
  • Update chai-jquery link
  • Use defined return value of Assertion extension functions
  • Update utility docs
0.5.3 April 21, 2012
  • Merge branch 'refs/heads/jgonera-oldbrowsers'
  • browser build
  • fixed reserved names for old browsers in interface/assert
  • fixed reserved names for old browsers in interface/should
  • fixed: chai.js no longer contains fail()
  • fixed reserved names for old browsers in Assertion
  • Merge pull request #49 from joliss/build-order
  • Make order of source files well-defined
  • Merge pull request #43 from zzen/patch-1
  • Support for expected and actual parameters in assert-style error object
  • chai as promised - readme
0.5.2 March 21, 2012
  • browser build
  • Merge branch 'feature/assert-fail'
  • Added assert.fail. Closes #40
  • Merge branch 'bug/operator-msg'
  • better error message for assert.operator. Closes #39
  • version notes
0.5.1 March 14, 2012
  • chai.fail no longer exists
  • Merge branch 'feature/assertdefined'
  • Added asset#isDefined. Closes #37.
  • dev docs update for Assertion#assert
0.5.0 March 07, 2012
  • [bug] on inspect of reg on n 0.4.12
  • Merge branch 'bug/33-throws'
  • Merge pull request #35 from logicalparadox/empty-object
  • browser build
  • updated #throw docs
  • Assertion#throw should tests updated
  • Assertion#throw expect tests
  • Should interface supports multiple throw parameters
  • Update Assertion#throw to support strings and type checks.
  • Add more tests for empty in should.
  • Add more tests for empty in expect.
  • Merge branch 'master' into empty-object
  • don't switch act/exp
  • Merge pull request #34 from logicalparadox/assert-operator
  • Update the compiled verison.
  • Add assert.operator.
  • Notes on messages. #22
  • browser build
  • have been test
  • below tests
  • Merge branch 'feature/actexp'
  • browser build
  • remove unnecessary fail export
  • full support for actual/expected where relevant
  • Assertion.assert support expected value
  • clean up error
  • Update the compiled version.
  • Add object & sane arguments support to Assertion#empty.
0.4.2 February 28, 2012
  • fix for process not available in browser when used via browserify. Closes #28
  • Merge pull request #31 from joliss/doc
  • Document that "should" works in browsers other than IE
  • Merge pull request #30 from logicalparadox/assert-tests
  • Update the browser version of chai.
  • Update assert.doesNotThrow test in order to check the use case when type is a string.
  • Add test for assert.ifError.
  • Falsey -> falsy.
  • Full coverage for assert.throws and assert.doesNotThrow.
  • Add test for assert.doesNotThrow.
  • Add test for assert.throws.
  • Add test for assert.length.
  • Add test for assert.include.
  • Add test for assert.isBoolean.
  • Fix the implementation of assert.isNumber.
  • Add test for assert.isNumber.
  • Add test for assert.isString.
  • Add test for assert.isArray.
  • Add test for assert.isUndefined.
  • Add test for assert.isNotNull.
  • Fix assert.isNotNull implementation.
  • Fix assert.isNull implementation.
  • Add test for assert.isNull.
  • Add test for assert.notDeepEqual.
  • Add test for assert.deepEqual.
  • Add test for assert.notStrictEqual.
  • Add test for assert.strictEqual.
  • Add test for assert.notEqual.
0.4.1 February 26, 2012
  • Merge pull request #27 from logicalparadox/type-fix
  • Update the browser version.
  • Add should tests for type checks.
  • Add function type check test.
  • Add more type checks tests.
  • Add test for new Number type check.
  • Fix type of actual checks.
0.4.0 February 25, 2012
  • docs and readme for upcoming 0.4.0
  • docs generated
  • putting coverage and tests for docs in docs/out/support
  • make docs
  • makefile copy necessary resources for tests in docs
  • rename configuration test
  • Merge pull request #21 from logicalparadox/close-to
  • Update the browser version.
  • Update closeTo() docs.
  • Add Assertion.closeTo() method.
  • Add .closeTo() should test.
  • Add .closeTo() expect test.
  • Merge pull request #20 from logicalparadox/satisfy
  • Update the browser version.
  • .. -> () in .satisfy() should test.
  • Update example for .satisfy().
  • Update the compiled browser version.
  • Add Assertion.satisfy() method.
  • Add .satisfy() should test.
  • Add .satisfy() expect test.
  • Merge pull request #19 from logicalparadox/respond-to
  • Update the compiled browser version.
  • Add respondTo Assertion.
  • Add respondTo should test.
  • Add respondTo expect test.
  • Merge branch 'feature/coverage'
  • mocha coverage support
  • doc contributors
  • README contributors
0.3.4 February 23, 2012
  • inline comment typos for #15
  • Merge branch 'refs/heads/jeffbski-configErrorStackCompat'
  • includeStack documentation for all interfaces
  • suite name more generic
  • Update test to be compatible with browsers that do not support err.stack
  • udpated compiled chai.js and added to browser tests
  • Allow inclusion of stack trace for Assert error messages to be configurable
  • docs sharing buttons
  • sinon-chai link
  • doc updates
  • read me updates include plugins
0.3.3 February 12, 2012
  • Merge pull request #14 from jfirebaugh/configurable_properties
  • Make Assertion.prototype properties configurable
0.3.2 February 10, 2012
  • codex version
  • docs
  • docs cleanup
0.3.1 February 07, 2012
  • node 0.4.x compat
0.3.0 February 07, 2012
  • Merge branch 'feature/03x'
  • browser build
  • remove html/json/headers testign
  • regex error.message testing
  • tests for using plugins
  • Merge pull request #11 from domenic/master
  • Make chai.use a no-op if the function has already been used.
0.2.4 February 02, 2012
  • added in past tense switch for been
0.2.3 February 02, 2012
  • try that again
0.2.2 February 02, 2012
  • added been (past of be) alias
0.2.1 January 30, 2012
  • added Throw, with a capital T, as an alias to throw (#7)
0.2.0 January 27, 2012
  • update gitignore for vim *.swp
  • Merge branch 'feature/plugins'
  • browser build
  • interfaces now work with use
  • simple .use function. See #9.
  • readme notice on browser compat
0.1.7 January 25, 2012
  • added assert tests to browser test runner
  • browser update
  • should interface patch for primitives support in FF
  • fix isObject() Thanks @milewise
  • travis only on branch master
  • add instanceof alias instanceOf. #6
  • some tests for assert module
0.1.6 January 02, 2012
  • commenting for assert interface
  • updated codex dep
0.1.5 January 02, 2012
  • browser tests pass
  • type in should.not.equal
  • test for should (not) exist
  • added should.exist and should.not.exist
  • browser uses tdd
  • convert tests to tdd
0.1.4 December 26, 2011
  • browser lib update for new assert interface compatiblitiy
  • inspect typos
  • added strict equal + negatives and ifError
  • interface assert had doesNotThrow
  • added should tests to browser
  • new expect empty tests
  • should test browser compat
  • Fix typo for instanceof docs. Closes #3 [ci skip]
0.1.3 December 18, 2011
  • much cleaner reporting string on error.
0.1.2 December 18, 2011
  • [docs] for upcoming 0.1.2
  • browser version built with pre/suffix ??? all tests passing
  • make / compile now use prefix/suffix correctly
  • code clean
  • prefix/suffix to wrap browser output to prevent conflicts with other require methods.
  • Merge branch 'feature/should4xcompatibility'
  • compile for browser tests.. all pass
  • added header/status/html/json
  • throw tests
  • should.throw & should.not.throw shortcuts
  • improved throw type detection and messaging
  • contain is now include ??? keys modifier is now contain
  • removed object() test
  • removed #respondTo
  • Merge branch 'bug/2'
  • replaced defineGetter with defineProperty for all uses
  • [docs] change mp tracking code
  • docs site updated with assert (TDD) interface
  • updated doc comments for assert interface
0.1.1 December 16, 2011
  • docs ready for upcoming 0.1.1
  • readme image fixed [ci skip]
  • more readme tweaks [ci skip]
  • r??admet image fixed [ci skip]
  • documentation
  • codex locked in version 0.0.5
  • more comments to assertions for docs
  • assertions fully commented, browser library updated
  • adding codex as doc dependancy
  • prepping for docs
  • assertion component completely commented for documentation
  • added exist test
  • var expect outside of browser if check
  • added keywords to package.json
0.1.0 December 15, 2011
  • failing on purpose successful .. back to normal
  • testing travis failure
  • assert#arguments getter
  • readme typo
  • updated README
  • added travis and npmignore
  • copyright notices ??? think i got them all
  • moved expect interface to own file for consistency
  • assert ui deepEqual
  • browser tests expect (all working)
  • browser version built
  • chai.fail (should ui)
  • expect tests browser compatible
  • tests for should and expect (all pass)
  • moved fail to primary export
  • should compatibility testing
  • within, greaterThan, object, keys,
  • Aliases
  • Assertion#property now correctly works with negate and undefined values
  • error message language matches should
  • Assertion#respondTo
  • Assertion now uses inspect util
  • git ignore node modules
  • should is exported
  • AssertionError proto from Error.prototype
  • add should interface for should.js compatibility
  • moved eql to until folder and added inspect from (joyent/node)
  • added mocha for testing
  • browser build for current api
  • multiple .property assertions
  • added deep equal from node
0.0.2 December 07, 2011
  • cleaner output on error
  • improved exists detection
  • package remnant artifact
  • empty deep equal
  • test browser build
  • assertion cleanup
  • client compile script
  • makefile
  • most of the basic assertions
  • allow no parameters to assertion error
  • name change
  • assertion error instance
  • main exports: assert() & expect()
  • initialize
0.0.1 December 07, 2011