NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #458 most downloaded on npm
BDD/TDD assertion library for node.js and the browser. Test framework agnostic.
Last release 4 days ago
30 Sep 2026
Release timing varies
gaps range from 3 weeks to 9 months
Nearly every release is documented
notes for 57 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
15 years old
111 releases · first in 2011
build(deps): bump qs from 6.11.2 to 6.14.1 by @dependabot [bot] in #1760
NODE_AUTH_TOKEN from publish script by @keithamus in #1763Full Changelog: v6.2.2...v6.3.0
One column per quarter.
build(deps-dev): bump js-yaml from 4.1.0 to 4.1.1 by @dependabot [bot] in #1745
Full Changelog: v6.2.1...v6.2.2
chore: add renovate config by @43081j in #1709
Full Changelog: v6.2.0...v6.2.1
feat(events): add addChainableMethod event by @perrin4869 in #1707
Full Changelog: v6.1.0...v6.2.0
build(deps-dev): bump tar-fs from 3.0.9 to 3.1.1 by @dependabot [bot] in #1706
Full Changelog: v6.0.2...v6.1.0
fix: keep function/class names in bundle by @43081j in #1701
Full Changelog: v6.0.0...v6.0.1
Chai is now bundled into a single file. The lib/*.js files are no longer present, and so any code that imports those files directly will need to chang
Chai is now bundled into a single file. The lib/*.js files are no longer present, and so any code that imports those files directly will need to change. The only file that can be imported now is ./index.js.
Full Changelog: v5.3.2...v6.0.0
fix: keep names in bundle by @43081j in #1702
Reverts the removal of the bundled version of chai in 5.3.1
Reverts the removal of the bundled version of chai in 5.3.1
Full Changelog: v5.3.1...v5.3.2
chore: remove bundled chai by @43081j in #1694
chore: change main to point at chai directly by @43081j in https://github.com/chaijs/chai/pull/1696
main to point at chai directly by @43081j in https://github.com/chaijs/chai/pull/1696Full Changelog: https://github.com/chaijs/chai/compare/v5.2.2...v5.3.0
chore: use files for publishing by @43081j in https://github.com/chaijs/chai/pull/1695
files for publishing by @43081j in https://github.com/chaijs/chai/pull/1695Full Changelog: https://github.com/chaijs/chai/compare/v5.2.1...v5.2.2
Mostly internal changes but @SuperchupuDev realised the package.json engines field was out of date, so it has been updated to reflect that v5.0.0 onwa
Mostly internal changes but @SuperchupuDev realised the package.json engines field was out of date, so it has been updated to reflect that v5.0.0 onwards only supports Node >=18.
no-var rule and fix violations by @koddsson in https://github.com/chaijs/chai/pull/1675Full Changelog: https://github.com/chaijs/chai/compare/v5.2.0...v5.2.1
fix: ability to register more plugins inside a plugin by @tpluscode in https://github.com/chaijs/chai/pull/1639
chai-subset and added assert-based negation to containSubset by @BreadInvasion in https://github.com/chaijs/chai/pull/1664Full Changelog: https://github.com/chaijs/chai/compare/v5.1.2...v5.2.0
Fix secret name in publish action by @koddsson in https://github.com/chaijs/chai/pull/1614
Full Changelog: https://github.com/chaijs/chai/compare/v5.1.1...v5.1.2
Set up ESLint for JSDoc comments by @koddsson in https://github.com/chaijs/chai/pull/1605
toThrow by @43081j in https://github.com/chaijs/chai/pull/1609Full Changelog: https://github.com/chaijs/chai/compare/v5.1.0...v5.1.1
Remove useless guards and add parentheses to constuctors by @koddsson in https://github.com/chaijs/chai/pull/1593
iterable assertion by @koddsson in https://github.com/chaijs/chai/pull/1592Full Changelog: https://github.com/chaijs/chai/compare/v5.0.3...v5.1.0
Fix bad v5.0.2 publish. Full Changelog: https://github.com/chaijs/chai/compare/v5.0.2...v5.0.3
Fix bad v5.0.2 publish.
Full Changelog: https://github.com/chaijs/chai/compare/v5.0.2...v5.0.3
build(deps): bump nanoid and mocha by @dependabot in https://github.com/chaijs/chai/pull/1558
bump-cli by @koddsson in https://github.com/chaijs/chai/pull/1559?? for node compat (5.x) by @43081j in https://github.com/chaijs/chai/pull/1576loupe to latest version by @koddsson in https://github.com/chaijs/chai/pull/1579Full Changelog: https://github.com/chaijs/chai/compare/v5.0.1...v5.0.2
fix: package.json - deprecation warning on exports field by @stevenjoezhang in https://github.com/chaijs/chai/pull/1400
import {...} from 'chai' or import('chai'). require('chai') will cause failures in nodejs. If you're using ESM and seeing failures, it may be due to a bundler or transpiler which is incorrectly converting import statements into require calls.get-func-name dependency by @koddsson in https://github.com/chaijs/chai/pull/1416deep-eql to latest version by @koddsson in https://github.com/chaijs/chai/pull/1542type-detect as a simple function by @koddsson in https://github.com/chaijs/chai/pull/1544assertion-error to it's latest major version! by @koddsson in https://github.com/chaijs/chai/pull/1543Full Changelog: https://github.com/chaijs/chai/compare/4.3.1...v5.0.0
fix: package.json - deprecation warning on exports field by @stevenjoezhang in https://github.com/chaijs/chai/pull/1400
The first Release Candidate of chai@v5 is here!
We've put out a few alpha versions and tested them out in various projects with good success. This RC includes all those changes plus any fixes that we've discovered since then.
Please try it out in your projects and let us know if you run into any issues so we can make fixes before version 5!
Thanks for using Chai 🙏🏻
get-func-name dependency by @koddsson in https://github.com/chaijs/chai/pull/1416deep-eql to latest version by @koddsson in https://github.com/chaijs/chai/pull/1542type-detect as a simple function by @koddsson in https://github.com/chaijs/chai/pull/1544assertion-error to it's latest major version! by @koddsson in https://github.com/chaijs/chai/pull/1543Full Changelog: https://github.com/chaijs/chai/compare/v4.3.10...v5.0.0-rc.0
update deep-eql to latest version by @koddsson in https://github.com/chaijs/chai/pull/1542
deep-eql to latest version by @koddsson in https://github.com/chaijs/chai/pull/1542type-detect as a simple function by @koddsson in https://github.com/chaijs/chai/pull/1544assertion-error to it's latest major version! by @koddsson in https://github.com/chaijs/chai/pull/1543Full Changelog: https://github.com/chaijs/chai/compare/v5.0.0-alpha.1...v5.0.0-alpha.2
chore: drop commonjs support by @43081j in https://github.com/chaijs/chai/pull/1503
Full Changelog: https://github.com/chaijs/chai/compare/v5.0.0-alpha.0...v5.0.0-alpha.1
This release is the first alpha release for Chai 5. The changes from v4.x:
This release is the first alpha release for Chai 5. The changes from v4.x:
Update type detect (#1631) 1a36d35
https://github.com/chaijs/chai/compare/v4.4.1...v4.5.0
Full Changelog: https://github.com/chaijs/chai/compare/v4.4.1...v4.5.0
fix: removes ?? for node compat by @43081j in https://github.com/chaijs/chai/pull/1574
?? for node compat by @43081j in https://github.com/chaijs/chai/pull/1574Full Changelog: https://github.com/chaijs/chai/compare/v4.4.0...v4.4.1
Allow deepEqual fonction to be configured globally (4.x.x branch) by @forty in https://github.com/chaijs/chai/pull/1553
Full Changelog: https://github.com/chaijs/chai/compare/v4.3.10...v4.4.0
This release simply bumps all dependencies to their latest non-breaking versions.
This release simply bumps all dependencies to their latest non-breaking versions.
Full Changelog: https://github.com/chaijs/chai/compare/v4.3.9...v4.3.10
This release upgrades dependencies to address [CVE-2023-43646](https://www.cve.org/CVERecord?id=CVE-2023-43646) where a large function name can cause…
Upgrade dependencies.
This release upgrades dependencies to address CVE-2023-43646 where a large function name can cause "catastrophic backtracking" (aka ReDOS attack) which can cause the test suite to hang.
Full Changelog: https://github.com/chaijs/chai/compare/v4.3.8...v4.3.9
4.x.x: Fix link to commit logs on GitHub by @bugwelle in https://github.com/chaijs/chai/pull/1487
Full Changelog: https://github.com/chaijs/chai/compare/v4.3.7...v4.3.8
fix: deep-eql bump package to support symbols comparison by @snewcomer in https://github.com/chaijs/chai/pull/1483
Full Changelog: https://github.com/chaijs/chai/compare/v4.3.6...v4.3.7
Nothing published for this version
fix: package.json - deprecation warning on exports field (#1400) 5276af6
https://github.com/chaijs/chai/compare/v4.3.4...v4.3.5
This fixes broken inspect behavior with bigints (#1321) (#1383) thanks @vapier
This fixes broken inspect behavior with bigints (#1321) (#1383) thanks @vapier
This reintroduces Assertion as an export in the mjs file. See https://github.com/chaijs/chai/pull/1378 & https://github.com/chaijs/chai/issues/1375
This reintroduces Assertion as an export in the mjs file. See https://github.com/chaijs/chai/pull/1378 & https://github.com/chaijs/chai/issues/1375
This fixes a regression in IE11. See https://github.com/chaijs/chai/pull/1380 & https://github.com/chaijs/chai/issues/1379
This fixes a regression in IE11. See https://github.com/chaijs/chai/pull/1380 & https://github.com/chaijs/chai/issues/1379
This fix also ensures pathval is updated to 1.1.1 to fix CVE-2020-7751
This releases fixed an engine incompatibility with 4.3.0
The 4.x.x series of releases will be compatible with Node 4.0. Please report any errors found in Node 4 as bugs, and they will be fixed.
The 5.x.x series, when released, will drop support for Node 4.0
This fix also ensures pathval is updated to 1.1.1 to fix CVE-2020-7751
Not many changes have got in since the last release but this one contains a very important change (#1257) which will allow jest users to get better di
This is a minor release.
Not many changes have got in since the last release but this one contains a very important change (#1257) which will allow jest users to get better diffs. From this release onwards, jest users will be able to see which operator was used in their diffs. The operator is a property of the AssertionError thrown when assertions fail. This flag indicates what kind of comparison was made.
This is also an important change for plugin maintainers. Plugin maintainers will now have access to the operator flag, which they can have access to through an utilmethod calledgetOperator`.
Thanks to all the amazing people that contributed to this release.
contain.oneOf to take an array of possible values (@voliva)closeTo error message will now inform the user when a delta is required (@eouw0o83hf)useProxy config is checked in overwriteProperty (@vieiralucas)contain.oneOf (@voliva )This is a minor release. Thank you to all of our contributors and users!
This is a minor release. Thank you to all of our contributors and users!
.deep.equal stack (#1124; @meeber)--use_strict (#1034, #1040; @shvaikalesh).string example (#1156, #1157; @meeber).property chaining examples (https://github.com/chaijs/chai/issues/193#issuecomment-360334369, #1130; @meeber).ok description (#1047; @shvaikalesh)This release fixes a bug when running in certain environments, and includes a few minor documentation fixes.
This release fixes a bug when running in certain environments, and includes a few minor documentation fixes.
deep-eql to version 3.0.0 (#1020)This release includes a few bug and documentation fixes.
This release includes a few bug and documentation fixes.
.instanceof to allow DOM interfaces in IE11 (#1000, #1008; @meeber).include to work with all objects (#1009, #1012; @meeber)This release includes one new feature and a few bug fixes.
This release includes one new feature and a few bug fixes.
.property assertion (#992; @meeber)expectTypes to access ssfi flag (#993; @meeber)We have another bugfix release, addressing some issues for WebPack 1 users.
We have another bugfix release, addressing some issues for WebPack 1 users.
Of course, any major release cannot go without a quick bugfix release shortly after - and here's ours!
Of course, any major release cannot go without a quick bugfix release shortly after - and here's ours!
Throw when non-existent property is read. _(Related Issues: #407, #766 PRs: #721, #770)_ This is a potentially breaking change. Your build will fail i…
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!
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);
}
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)
.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}});
this. (Related Issues: #562, #684, #723, PRs: #642, #660).members assertion. (Related Issues: #511, PRs: #702)same.members to properly handle duplicates by treating each one as a unique member. (Related Issues: #590, PRs: #739)overwriteMethod, overwriteProperty, addChainableMethod, overwriteChainableMethod functions will return new assertion with flags copied over instead of this. (Related Issues: #562, #642, #791, PRs: #799)keys assertions will now consider size of sets. (Related Issues: #919, PRs: #924)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
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
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.
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).
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.
Throw when non-existent property is read. _(Related Issues: #407, #766 PRs: #721, #770)_ This is a potentially breaking change. Your build will fail i…
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)
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)
.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;
this. (Related Issues: #562, #684, #723, PRs: #642, #660).members assertion. (Related Issues: #511, PRs: #702)same.members to properly handle duplicates by treating each one as a unique member. (Related Issues: #590, PRs: #739)overwriteMethod, overwriteProperty, addChainableMethod, overwriteChainableMethod functions will return new assertion with flags copied over instead of this. (Related Issues: #562, #642, #791, PRs: #799)For assert fans: you now have assert.includeDeepMembers() which matches expect().to.include.deep.members() and .should.include.deep.members()!
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:
assert.includeDeepMembers(). By @qbolecThis is a small documentation bug fix release - it just fixes a couple of issues with the documentation.
This is a small documentation bug fix release - it just fixes a couple of issues with the documentation.
.throws() example. By @PklongBugFix: .empty changes from 3.3.0 have been reverted, as they caused breaking changes to arrays which manually set keys.
This release improves some confusing error messages, and adds some new assertions. Key points:
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.empty changes from 3.3.0 have been reverted, as they caused breaking changes to arrays which manually set keys.expect(inList).to.be.oneOf assertion. By @Droogansnew Error type gets detected by the a/an matcher. By @jurko-gospodneticThis release adds some new assertions and fixes some quite important, long standing bugs. Here are the cliff notes:
This release adds some new assertions and fixes some quite important, long standing bugs. Here are the cliff notes:
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 passassert interface has been given the following new methods, to align better with other interfaces:, assert.isAtMost, assert.isAtLeast, assert.isNotTrue, assert.isNotFalse.assert.isNotTrue and assert.isNotFalse.
By @cezarykluczynskifrozen/extensible/sealed assertions behave the same in ES6 and ES5 environments.
By @astorije.empty assertion.
By @Daveloper87assert.isAtMost and assert.isAtLeast.
By @wraithanisBelow, isAbove, isTrue).
By @cezarykluczynskiThis 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.is
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:
getProperties() utility
By @jluchijiThis release adds assertions for extensibility/freezing/sealing on objects:
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;
version property from bower.json.
By @kkirscheThis release contains some small breaking changes. Most people are unlikely to notice them - but here are the breaking changes:
This release contains some small breaking changes. Most people are unlikely to notice them - but here are the breaking changes:
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.assert.ifError() behaves like Node.js: it throws if the first argument is present.
By @cjqed^1.0.1
By @keithamus (special thanks to @simonzack for his work on assertion-error).matches() as alias for .match().
By @thejameskyle.property('foo', undefined) now actually checks to see if obj.foo === undefined (before it did not).
By @onefifth.assert()
By @astorije.keys()
By @astorije.length(n) from the docs - use .lengthOf(n) instead.
By @valscion.length(n) examples to .lengthOf(n) instead.
By @keithamusassert.notInclude docs
By @BinaryMuseAdded ownPropertyDescriptor assertion:
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');
ownPropertyDescriptor
assertion.
By @ljharbDeep property strings can now be escaped using \\ - for example:
Deep property strings can now be escaped using \\ - for example:
var deepCss = { '.link': { '[target]': 42 }};
expect(deepCss).to.have.deep.property('\\.link.\\[target\\]', 42)
A minor bug fix. No new features.
Two minor bugfixes. No new features.
Two minor bugfixes. No new features.
deep.property would not work with single
key names. By @eldritch-fossickerSmall release; fixes an issue where the Chai lib was incorrectly reporting the version number.
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.
Unfortunately with 1.10.0 - compatibility broke with older versions because of the addChainableNoop. This change has been reverted.
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
.keys() now accepts Objects, extracting keys from them. By @gregglind.keys() no longer mutates passed arrays. By @gregglind.which. By @toastynerd.change, .increase and .decrease assertions. By @cmpolischai.util is now exposed @DingoEatingFuzz.includes and .contains aliases (for .include and .contain). By @lo1tuma.any.keys() and .all.keys() qualifiers. By @cjqedassert.sameDeepMembers(). By @cjqedassert.isAbove() and assert.isBelow(). By @cjqedproperty and deep.property now pass if a value is set to undefined. By @prodatakeyYour coding agent can read these notes before it upgrades. Set up the MCP server →