Comparing version 1.10.0 to 2.0.0
{ | ||
"name": "chai" | ||
, "version": "1.10.0" | ||
, "description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic." | ||
, "license": "MIT" | ||
, "keywords": [ | ||
"test" | ||
, "assertion" | ||
, "assert" | ||
, "testing" | ||
, "chai" | ||
] | ||
, "main": "chai.js" | ||
, "ignore": [ | ||
"build" | ||
, "components" | ||
, "lib" | ||
, "node_modules" | ||
, "support" | ||
, "test" | ||
, "index.js" | ||
, "Makefile" | ||
, ".*" | ||
] | ||
, "dependencies": {} | ||
, "devDependencies": {} | ||
"name": "chai", | ||
"version": "2.0.0", | ||
"description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic.", | ||
"license": "MIT", | ||
"keywords": [ | ||
"test", | ||
"assertion", | ||
"assert", | ||
"testing", | ||
"chai" | ||
], | ||
"main": "chai.js", | ||
"ignore": [ | ||
"build", | ||
"components", | ||
"lib", | ||
"node_modules", | ||
"support", | ||
"test", | ||
"index.js", | ||
"Makefile", | ||
".*" | ||
], | ||
"dependencies": {}, | ||
"devDependencies": {} | ||
} |
@@ -14,2 +14,3 @@ # Chai Contribution Guidelines | ||
- [Pull Requests](#pull-requests) | ||
- [Releasing](#releasing) | ||
- [Support](#support) | ||
@@ -140,2 +141,26 @@ - [Resources](#resources) | ||
<a name="releasing"></a> | ||
## Releasing | ||
Releases can be prepared by any core-contributor or user whom has push access to | ||
the `chaijs/chai` repository. | ||
This process requires [git-extras](https://github.com/tj/git-extras) for some steps. | ||
1. Ensure all tests pass. | ||
2. Bump the version tag in-code and for all package managers. | ||
- `lib/chai.js` | ||
- `package.json` | ||
- `component.json` | ||
- `bower.json` | ||
3. Build the browser version with `make`. | ||
4. Append commit log to `HISTORY.md` using `git changelog` command. | ||
5. Write human-friendly `ReleaseNotes.md` based on changelog. | ||
- If breaking changes, write migration tutorial(s) and reasoning. | ||
- Callouts for community contributions (PRs) with links to PR and contributing user. | ||
- Callouts for other fixes made by core contributors with links to issue. | ||
6. Update `README.md` with an updated contributors list using `git summary` command. | ||
7. Push a tagged release using `git release x.x.x`. | ||
- All tagged releases are published to NPM. | ||
<a name="support"></a> | ||
@@ -142,0 +167,0 @@ ## Support |
144
History.md
@@ -0,3 +1,57 @@ | ||
2.0.0 / 2015-02-09 | ||
================== | ||
1.10.0 / 2014-11-10 | ||
* Merge pull request #361 from gregglind/b265-keys-object | ||
* fix #359. Add `.keys(object)` | ||
* Merge pull request #359 from gregglind/b359-unexpected-keys-sort | ||
* Fix #359 keys() sorts input unexpectedly | ||
* contrib: publish release strategy and travis npm creds #337 | ||
* Merge pull request #357 from danilovaz/master | ||
* Update copyright date | ||
* Merge pull request #349 from toastynerd/add-which-chain-method | ||
* add the which chain method as per issue #347 | ||
* Merge pull request #333 from cmpolis/change-assertions | ||
* more `by` cleanup | ||
* cleaned out `.by` for #333 | ||
* Merge pull request #335 from DingoEatingFuzz/expose-util | ||
* Expose chai util through the chai object | ||
* cleanup (per notes on pr #333) | ||
* updated `change` to work w/ non-number values + tests | ||
* Merge pull request #334 from hurrymaplelad/patch-1 | ||
* Typo, the flag is called 'contains' with an 's' | ||
* updated assertion interface with `change` (#330) | ||
* added `change`,`increase`,`decrease` assertions (#330) | ||
* assert tests for `change`,`increase`,`decrease` | ||
* expect/should tests for `change`,`increase`,`decrease` | ||
* Merge pull request #328 from lo1tuma/issue-327 | ||
* Add includes and contains alias (fixes #327) | ||
* Merge pull request #325 from chasenlehara/overwriteChainableMethodDocs | ||
* Fix docs for overwriteChainableMethod parameters | ||
* Merge pull request #317 from jasonkarns/patch-2 | ||
* Merge pull request #318 from jasonkarns/patch-3 | ||
* Merge pull request #316 from jasonkarns/patch-1 | ||
* typos in docs | ||
* minor docs typo | ||
* update docs: getAllFlags -> transferFlags | ||
* Merge pull request #313 from cjqed/254-expect-any-all | ||
* Added the all and any flags for keys assertion, with all being the default behavior | ||
* Merge pull request #312 from cjqed/291-assert-same-deep-members | ||
* Changed public comment of sameDeepMemebers to be more clear | ||
* Fixes issue #291, adds assert.sameDeepMembers | ||
* Merge pull request #311 from cjqed/305-above-below-on-assert | ||
* Merge pull request #308 from prodatakey/hasproperty | ||
* Issue #305 fixed, added assert.isAbove and assert.isBelow | ||
* Fix typo | ||
* More unit tests for new utility functions | ||
* Refactor common functionality, document, test | ||
* Refactor if statement out | ||
* Small unit test fix | ||
* Handle array indexing terminating paths | ||
* Merge pull request #309 from ericdouglas/iterableEqual-couting-once | ||
* couting variables just once | ||
* Fix properties with `undefined` value pass property assertion | ||
* Merge pull request #306 from chaijs/revert-297-noopchainfunc | ||
* Revert "Allows writing lint-friendly tests" | ||
1.10.0 / 2014-11-10 | ||
================== | ||
@@ -22,3 +76,3 @@ | ||
1.9.2 / 2014-09-29 | ||
1.9.2 / 2014-09-29 | ||
================== | ||
@@ -45,3 +99,3 @@ | ||
1.9.1 / 2014-03-19 | ||
1.9.1 / 2014-03-19 | ||
================== | ||
@@ -70,3 +124,3 @@ | ||
1.9.0 / 2014-01-29 | ||
1.9.0 / 2014-01-29 | ||
================== | ||
@@ -113,3 +167,3 @@ | ||
1.8.1 / 2013-10-10 | ||
1.8.1 / 2013-10-10 | ||
================== | ||
@@ -119,3 +173,3 @@ | ||
1.8.0 / 2013-09-18 | ||
1.8.0 / 2013-09-18 | ||
================== | ||
@@ -135,3 +189,3 @@ | ||
1.7.2 / 2013-06-27 | ||
1.7.2 / 2013-06-27 | ||
================== | ||
@@ -149,3 +203,3 @@ | ||
1.7.1 / 2013-06-24 | ||
1.7.1 / 2013-06-24 | ||
================== | ||
@@ -157,3 +211,3 @@ | ||
1.7.0 / 2013-06-17 | ||
1.7.0 / 2013-06-17 | ||
================== | ||
@@ -177,3 +231,3 @@ | ||
1.6.1 / 2013-06-05 | ||
1.6.1 / 2013-06-05 | ||
================== | ||
@@ -189,3 +243,3 @@ | ||
1.6.0 / 2013-04-29 | ||
1.6.0 / 2013-04-29 | ||
================== | ||
@@ -213,3 +267,3 @@ | ||
1.5.0 / 2013-02-03 | ||
1.5.0 / 2013-02-03 | ||
================== | ||
@@ -270,3 +324,3 @@ | ||
1.4.2 / 2012-12-21 | ||
1.4.2 / 2012-12-21 | ||
================== | ||
@@ -278,3 +332,3 @@ | ||
1.4.1 / 2012-12-21 | ||
1.4.1 / 2012-12-21 | ||
================== | ||
@@ -288,3 +342,3 @@ | ||
1.4.0 / 2012-11-29 | ||
1.4.0 / 2012-11-29 | ||
================== | ||
@@ -305,3 +359,3 @@ | ||
1.3.0 / 2012-10-01 | ||
1.3.0 / 2012-10-01 | ||
================== | ||
@@ -327,3 +381,3 @@ | ||
1.2.0 / 2012-08-07 | ||
1.2.0 / 2012-08-07 | ||
================== | ||
@@ -348,3 +402,3 @@ | ||
1.1.1 / 2012-07-09 | ||
1.1.1 / 2012-07-09 | ||
================== | ||
@@ -363,3 +417,3 @@ | ||
1.1.0 / 2012-06-26 | ||
1.1.0 / 2012-06-26 | ||
================== | ||
@@ -389,3 +443,3 @@ | ||
1.0.4 / 2012-06-03 | ||
1.0.4 / 2012-06-03 | ||
================== | ||
@@ -398,3 +452,3 @@ | ||
1.0.3 / 2012-05-27 | ||
1.0.3 / 2012-05-27 | ||
================== | ||
@@ -407,3 +461,3 @@ | ||
1.0.2 / 2012-05-26 | ||
1.0.2 / 2012-05-26 | ||
================== | ||
@@ -422,3 +476,3 @@ | ||
1.0.1 / 2012-05-18 | ||
1.0.1 / 2012-05-18 | ||
================== | ||
@@ -436,3 +490,3 @@ | ||
1.0.0 / 2012-05-15 | ||
1.0.0 / 2012-05-15 | ||
================== | ||
@@ -456,3 +510,3 @@ | ||
1.0.0-rc3 / 2012-05-09 | ||
1.0.0-rc3 / 2012-05-09 | ||
================== | ||
@@ -491,3 +545,3 @@ | ||
1.0.0-rc2 / 2012-05-06 | ||
1.0.0-rc2 / 2012-05-06 | ||
================== | ||
@@ -504,3 +558,3 @@ | ||
1.0.0-rc1 / 2012-05-04 | ||
1.0.0-rc1 / 2012-05-04 | ||
================== | ||
@@ -612,3 +666,3 @@ | ||
0.5.3 / 2012-04-21 | ||
0.5.3 / 2012-04-21 | ||
================== | ||
@@ -628,3 +682,3 @@ | ||
0.5.2 / 2012-03-21 | ||
0.5.2 / 2012-03-21 | ||
================== | ||
@@ -639,3 +693,3 @@ | ||
0.5.1 / 2012-03-14 | ||
0.5.1 / 2012-03-14 | ||
================== | ||
@@ -648,3 +702,3 @@ | ||
0.5.0 / 2012-03-07 | ||
0.5.0 / 2012-03-07 | ||
================== | ||
@@ -681,3 +735,3 @@ | ||
0.4.2 / 2012-02-28 | ||
0.4.2 / 2012-02-28 | ||
================== | ||
@@ -714,3 +768,3 @@ | ||
0.4.1 / 2012-02-26 | ||
0.4.1 / 2012-02-26 | ||
================== | ||
@@ -726,3 +780,3 @@ | ||
0.4.0 / 2012-02-25 | ||
0.4.0 / 2012-02-25 | ||
================== | ||
@@ -760,3 +814,3 @@ | ||
0.3.4 / 2012-02-23 | ||
0.3.4 / 2012-02-23 | ||
================== | ||
@@ -776,3 +830,3 @@ | ||
0.3.3 / 2012-02-12 | ||
0.3.3 / 2012-02-12 | ||
================== | ||
@@ -783,3 +837,3 @@ | ||
0.3.2 / 2012-02-10 | ||
0.3.2 / 2012-02-10 | ||
================== | ||
@@ -791,3 +845,3 @@ | ||
0.3.1 / 2012-02-07 | ||
0.3.1 / 2012-02-07 | ||
================== | ||
@@ -797,3 +851,3 @@ | ||
0.3.0 / 2012-02-07 | ||
0.3.0 / 2012-02-07 | ||
================== | ||
@@ -809,3 +863,3 @@ | ||
0.2.4 / 2012-02-02 | ||
0.2.4 / 2012-02-02 | ||
================== | ||
@@ -815,3 +869,3 @@ | ||
0.2.3 / 2012-02-01 | ||
0.2.3 / 2012-02-01 | ||
================== | ||
@@ -821,3 +875,3 @@ | ||
0.2.2 / 2012-02-01 | ||
0.2.2 / 2012-02-01 | ||
================== | ||
@@ -827,3 +881,3 @@ | ||
0.2.1 / 2012-01-29 | ||
0.2.1 / 2012-01-29 | ||
================== | ||
@@ -833,3 +887,3 @@ | ||
0.2.0 / 2012-01-26 | ||
0.2.0 / 2012-01-26 | ||
================== | ||
@@ -844,3 +898,3 @@ | ||
0.1.7 / 2012-01-25 | ||
0.1.7 / 2012-01-25 | ||
================== | ||
@@ -847,0 +901,0 @@ |
@@ -48,2 +48,8 @@ /*! | ||
/*! | ||
* Utility Functions | ||
*/ | ||
exports.util = util; | ||
/*! | ||
* Configuration | ||
@@ -50,0 +56,0 @@ */ |
@@ -9,3 +9,2 @@ /*! | ||
var config = require('./config'); | ||
var NOOP = function() { }; | ||
@@ -74,6 +73,2 @@ module.exports = function (_chai, util) { | ||
Assertion.addChainableNoop = function(name, fn) { | ||
util.addChainableMethod(this.prototype, name, NOOP, fn); | ||
}; | ||
Assertion.overwriteProperty = function (name, fn) { | ||
@@ -80,0 +75,0 @@ util.overwriteProperty(this.prototype, name, fn); |
@@ -28,2 +28,3 @@ /*! | ||
* - that | ||
* - which | ||
* - and | ||
@@ -43,3 +44,3 @@ * - has | ||
, 'is', 'and', 'has', 'have' | ||
, 'with', 'that', 'at' | ||
, 'with', 'that', 'which', 'at' | ||
, 'of', 'same' ].forEach(function (chain) { | ||
@@ -88,2 +89,37 @@ Assertion.addProperty(chain, function () { | ||
/** | ||
* ### .any | ||
* | ||
* Sets the `any` flag, (opposite of the `all` flag) | ||
* later used in the `keys` assertion. | ||
* | ||
* expect(foo).to.have.any.keys('bar', 'baz'); | ||
* | ||
* @name any | ||
* @api public | ||
*/ | ||
Assertion.addProperty('any', function () { | ||
flag(this, 'any', true); | ||
flag(this, 'all', false) | ||
}); | ||
/** | ||
* ### .all | ||
* | ||
* Sets the `all` flag (opposite of the `any` flag) | ||
* later used by the `keys` assertion. | ||
* | ||
* expect(foo).to.have.all.keys('bar', 'baz'); | ||
* | ||
* @name all | ||
* @api public | ||
*/ | ||
Assertion.addProperty('all', function () { | ||
flag(this, 'all', true); | ||
flag(this, 'any', false); | ||
}); | ||
/** | ||
* ### .a(type) | ||
@@ -133,3 +169,3 @@ * | ||
* in an array or a substring in a string. When used as language chains, | ||
* they toggle the `contain` flag for the `keys` assertion. | ||
* they toggle the `contains` flag for the `keys` assertion. | ||
* | ||
@@ -142,2 +178,4 @@ * expect([1,2,3]).to.include(2); | ||
* @alias contain | ||
* @alias includes | ||
* @alias contains | ||
* @param {Object|String|Number} obj | ||
@@ -168,7 +206,7 @@ * @param {String} message _optional_ | ||
} | ||
var subset = {} | ||
for (var k in val) subset[k] = obj[k] | ||
var subset = {}; | ||
for (var k in val) subset[k] = obj[k]; | ||
expected = _.eql(subset, val); | ||
} else { | ||
expected = obj && ~obj.indexOf(val) | ||
expected = obj && ~obj.indexOf(val); | ||
} | ||
@@ -183,2 +221,4 @@ this.assert( | ||
Assertion.addChainableMethod('contain', include, includeChainingBehavior); | ||
Assertion.addChainableMethod('contains', include, includeChainingBehavior); | ||
Assertion.addChainableMethod('includes', include, includeChainingBehavior); | ||
@@ -196,6 +236,2 @@ /** | ||
* | ||
* Can also be used as a function, which prevents some linter errors. | ||
* | ||
* expect('everthing').to.be.ok(); | ||
* | ||
* @name ok | ||
@@ -205,3 +241,3 @@ * @api public | ||
Assertion.addChainableNoop('ok', function () { | ||
Assertion.addProperty('ok', function () { | ||
this.assert( | ||
@@ -221,6 +257,2 @@ flag(this, 'object') | ||
* | ||
* Can also be used as a function, which prevents some linter errors. | ||
* | ||
* expect(true).to.be.true(); | ||
* | ||
* @name true | ||
@@ -230,3 +262,3 @@ * @api public | ||
Assertion.addChainableNoop('true', function () { | ||
Assertion.addProperty('true', function () { | ||
this.assert( | ||
@@ -248,6 +280,2 @@ true === flag(this, 'object') | ||
* | ||
* Can also be used as a function, which prevents some linter errors. | ||
* | ||
* expect(false).to.be.false(); | ||
* | ||
* @name false | ||
@@ -257,3 +285,3 @@ * @api public | ||
Assertion.addChainableNoop('false', function () { | ||
Assertion.addProperty('false', function () { | ||
this.assert( | ||
@@ -275,6 +303,2 @@ false === flag(this, 'object') | ||
* | ||
* Can also be used as a function, which prevents some linter errors. | ||
* | ||
* expect(null).to.be.null(); | ||
* | ||
* @name null | ||
@@ -284,3 +308,3 @@ * @api public | ||
Assertion.addChainableNoop('null', function () { | ||
Assertion.addProperty('null', function () { | ||
this.assert( | ||
@@ -301,6 +325,2 @@ null === flag(this, 'object') | ||
* | ||
* Can also be used as a function, which prevents some linter errors. | ||
* | ||
* expect(undefined).to.be.undefined(); | ||
* | ||
* @name undefined | ||
@@ -310,3 +330,3 @@ * @api public | ||
Assertion.addChainableNoop('undefined', function () { | ||
Assertion.addProperty('undefined', function () { | ||
this.assert( | ||
@@ -332,6 +352,2 @@ undefined === flag(this, 'object') | ||
* | ||
* Can also be used as a function, which prevents some linter errors. | ||
* | ||
* expect(foo).to.exist(); | ||
* | ||
* @name exist | ||
@@ -341,3 +357,3 @@ * @api public | ||
Assertion.addChainableNoop('exist', function () { | ||
Assertion.addProperty('exist', function () { | ||
this.assert( | ||
@@ -362,6 +378,2 @@ null != flag(this, 'object') | ||
* | ||
* Can also be used as a function, which prevents some linter errors. | ||
* | ||
* expect([]).to.be.empty(); | ||
* | ||
* @name empty | ||
@@ -371,3 +383,3 @@ * @api public | ||
Assertion.addChainableNoop('empty', function () { | ||
Assertion.addProperty('empty', function () { | ||
var obj = flag(this, 'object') | ||
@@ -398,8 +410,2 @@ , expected = obj; | ||
* | ||
* Can also be used as a function, which prevents some linter errors. | ||
* | ||
* function test () { | ||
* expect(arguments).to.be.arguments(); | ||
* } | ||
* | ||
* @name arguments | ||
@@ -420,4 +426,4 @@ * @alias Arguments | ||
Assertion.addChainableNoop('arguments', checkArguments); | ||
Assertion.addChainableNoop('Arguments', checkArguments); | ||
Assertion.addProperty('arguments', checkArguments); | ||
Assertion.addProperty('Arguments', checkArguments); | ||
@@ -825,7 +831,12 @@ /** | ||
var descriptor = flag(this, 'deep') ? 'deep property ' : 'property ' | ||
var isDeep = !!flag(this, 'deep') | ||
, descriptor = isDeep ? 'deep property ' : 'property ' | ||
, negate = flag(this, 'negate') | ||
, obj = flag(this, 'object') | ||
, value = flag(this, 'deep') | ||
? _.getPathValue(name, obj) | ||
, pathInfo = isDeep ? _.getPathInfo(name, obj) : null | ||
, hasProperty = isDeep | ||
? pathInfo.exists | ||
: _.hasProperty(name, obj) | ||
, value = isDeep | ||
? pathInfo.value | ||
: obj[name]; | ||
@@ -840,3 +851,3 @@ | ||
this.assert( | ||
undefined !== value | ||
hasProperty | ||
, 'expected #{this} to have a ' + descriptor + _.inspect(name) | ||
@@ -987,12 +998,34 @@ , 'expected #{this} to not have ' + descriptor + _.inspect(name)); | ||
* | ||
* Asserts that the target has exactly the given keys, or | ||
* asserts the inclusion of some keys when using the | ||
* `include` or `contain` modifiers. | ||
* Asserts that the target contains any or all of the passed-in keys. | ||
* Use in combination with `any`, `all`, `contains`, or `have` will affect | ||
* what will pass. | ||
* | ||
* When used in conjunction with `any`, at least one key that is passed | ||
* in must exist in the target object. This is regardless whether or not | ||
* the `have` or `contain` qualifiers are used. Note, either `any` or `all` | ||
* should be used in the assertion. If neither are used, the assertion is | ||
* defaulted to `all`. | ||
* | ||
* When both `all` and `contain` are used, the target object must have at | ||
* least all of the passed-in keys but may have more keys not listed. | ||
* | ||
* When both `all` and `have` are used, the target object must both contain | ||
* all of the passed-in keys AND the number of keys in the target object must | ||
* match the number of keys passed in (in other words, a target object must | ||
* have all and only all of the passed-in keys). | ||
* | ||
* expect({ foo: 1, bar: 2 }).to.have.any.keys('foo', 'baz'); | ||
* expect({ foo: 1, bar: 2 }).to.have.any.keys('foo'); | ||
* expect({ foo: 1, bar: 2 }).to.contain.any.keys('bar', 'baz'); | ||
* expect({ foo: 1, bar: 2 }).to.contain.any.keys(['foo']); | ||
* expect({ foo: 1, bar: 2 }).to.contain.any.keys({'foo': 6}); | ||
* expect({ foo: 1, bar: 2 }).to.have.all.keys(['bar', 'foo']); | ||
* expect({ foo: 1, bar: 2 }).to.have.all.keys({'bar': 6, 'foo', 7}); | ||
* expect({ foo: 1, bar: 2, baz: 3 }).to.contain.all.keys(['bar', 'foo']); | ||
* expect({ foo: 1, bar: 2, baz: 3 }).to.contain.all.keys([{'bar': 6}}]); | ||
* | ||
* expect({ foo: 1, bar: 2 }).to.have.keys(['foo', 'bar']); | ||
* expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('foo', 'bar'); | ||
* | ||
* @name keys | ||
* @alias key | ||
* @param {String...|Array} keys | ||
* @param {String...|Array|Object} keys | ||
* @api public | ||
@@ -1004,7 +1037,16 @@ */ | ||
, str | ||
, ok = true; | ||
, ok = true | ||
, mixedArgsMsg = 'keys must be given single argument of Array|Object|String, or multiple String arguments'; | ||
keys = keys instanceof Array | ||
? keys | ||
: Array.prototype.slice.call(arguments); | ||
switch (_.type(keys)) { | ||
case "array": | ||
if (arguments.length > 1) throw (new Error(mixedArgsMsg)); | ||
break; | ||
case "object": | ||
if (arguments.length > 1) throw (new Error(mixedArgsMsg)); | ||
keys = Object.keys(keys); | ||
break; | ||
default: | ||
keys = Array.prototype.slice.call(arguments); | ||
} | ||
@@ -1015,14 +1057,28 @@ if (!keys.length) throw new Error('keys required'); | ||
, expected = keys | ||
, len = keys.length; | ||
, len = keys.length | ||
, any = flag(this, 'any') | ||
, all = flag(this, 'all'); | ||
// Inclusion | ||
ok = keys.every(function(key){ | ||
return ~actual.indexOf(key); | ||
}); | ||
if (!any && !all) { | ||
all = true; | ||
} | ||
// Strict | ||
if (!flag(this, 'negate') && !flag(this, 'contains')) { | ||
ok = ok && keys.length == actual.length; | ||
// Has any | ||
if (any) { | ||
var intersection = expected.filter(function(key) { | ||
return ~actual.indexOf(key); | ||
}); | ||
ok = intersection.length > 0; | ||
} | ||
// Has all | ||
if (all) { | ||
ok = keys.every(function(key){ | ||
return ~actual.indexOf(key); | ||
}); | ||
if (!flag(this, 'negate') && !flag(this, 'contains')) { | ||
ok = ok && keys.length == actual.length; | ||
} | ||
} | ||
// Key string | ||
@@ -1034,3 +1090,8 @@ if (len > 1) { | ||
var last = keys.pop(); | ||
str = keys.join(', ') + ', and ' + last; | ||
if (all) { | ||
str = keys.join(', ') + ', and ' + last; | ||
} | ||
if (any) { | ||
str = keys.join(', ') + ', or ' + last; | ||
} | ||
} else { | ||
@@ -1051,3 +1112,3 @@ str = _.inspect(keys[0]); | ||
, 'expected #{this} to not ' + str | ||
, expected.sort() | ||
, expected.slice(0).sort() | ||
, actual.sort() | ||
@@ -1389,2 +1450,116 @@ , true | ||
}); | ||
/** | ||
* ### .change(function) | ||
* | ||
* Asserts that a function changes an object property | ||
* | ||
* var obj = { val: 10 }; | ||
* var fn = function() { obj.val += 3 }; | ||
* var noChangeFn = function() { return 'foo' + 'bar'; } | ||
* expect(fn).to.change(obj, 'val'); | ||
* expect(noChangFn).to.not.change(obj, 'val') | ||
* | ||
* @name change | ||
* @alias changes | ||
* @alias Change | ||
* @param {String} object | ||
* @param {String} property name | ||
* @param {String} message _optional_ | ||
* @api public | ||
*/ | ||
function assertChanges (object, prop, msg) { | ||
if (msg) flag(this, 'message', msg); | ||
var fn = flag(this, 'object'); | ||
new Assertion(object, msg).to.have.property(prop); | ||
new Assertion(fn).is.a('function'); | ||
var initial = object[prop]; | ||
fn(); | ||
this.assert( | ||
initial !== object[prop] | ||
, 'expected .' + prop + ' to change' | ||
, 'expected .' + prop + ' to not change' | ||
); | ||
} | ||
Assertion.addChainableMethod('change', assertChanges); | ||
Assertion.addChainableMethod('changes', assertChanges); | ||
/** | ||
* ### .increase(function) | ||
* | ||
* Asserts that a function increases an object property | ||
* | ||
* var obj = { val: 10 }; | ||
* var fn = function() { obj.val = 15 }; | ||
* expect(fn).to.increase(obj, 'val'); | ||
* | ||
* @name increase | ||
* @alias increases | ||
* @alias Increase | ||
* @param {String} object | ||
* @param {String} property name | ||
* @param {String} message _optional_ | ||
* @api public | ||
*/ | ||
function assertIncreases (object, prop, msg) { | ||
if (msg) flag(this, 'message', msg); | ||
var fn = flag(this, 'object'); | ||
new Assertion(object, msg).to.have.property(prop); | ||
new Assertion(fn).is.a('function'); | ||
var initial = object[prop]; | ||
fn(); | ||
this.assert( | ||
object[prop] - initial > 0 | ||
, 'expected .' + prop + ' to increase' | ||
, 'expected .' + prop + ' to not increase' | ||
); | ||
} | ||
Assertion.addChainableMethod('increase', assertIncreases); | ||
Assertion.addChainableMethod('increases', assertIncreases); | ||
/** | ||
* ### .decrease(function) | ||
* | ||
* Asserts that a function decreases an object property | ||
* | ||
* var obj = { val: 10 }; | ||
* var fn = function() { obj.val = 5 }; | ||
* expect(fn).to.decrease(obj, 'val'); | ||
* | ||
* @name decrease | ||
* @alias decreases | ||
* @alias Decrease | ||
* @param {String} object | ||
* @param {String} property name | ||
* @param {String} message _optional_ | ||
* @api public | ||
*/ | ||
function assertDecreases (object, prop, msg) { | ||
if (msg) flag(this, 'message', msg); | ||
var fn = flag(this, 'object'); | ||
new Assertion(object, msg).to.have.property(prop); | ||
new Assertion(fn).is.a('function'); | ||
var initial = object[prop]; | ||
fn(); | ||
this.assert( | ||
object[prop] - initial < 0 | ||
, 'expected .' + prop + ' to decrease' | ||
, 'expected .' + prop + ' to not decrease' | ||
); | ||
} | ||
Assertion.addChainableMethod('decrease', assertDecreases); | ||
Assertion.addChainableMethod('decreases', assertDecreases); | ||
}; |
@@ -240,2 +240,38 @@ /*! | ||
assert.isAbove = function (val, abv, msg) { | ||
new Assertion(val, msg).to.be.above(abv); | ||
}; | ||
/** | ||
* ### .isAbove(valueToCheck, valueToBeAbove, [message]) | ||
* | ||
* Asserts `valueToCheck` is strictly greater than (>) `valueToBeAbove` | ||
* | ||
* assert.isAbove(5, 2, '5 is strictly greater than 2'); | ||
* | ||
* @name isAbove | ||
* @param {Mixed} valueToCheck | ||
* @param {Mixed} valueToBeAbove | ||
* @param {String} message | ||
* @api public | ||
*/ | ||
assert.isBelow = function (val, blw, msg) { | ||
new Assertion(val, msg).to.be.below(blw); | ||
}; | ||
/** | ||
* ### .isBelow(valueToCheck, valueToBeBelow, [message]) | ||
* | ||
* Asserts `valueToCheck` is strictly less than (<) `valueToBeBelow` | ||
* | ||
* assert.isBelow(3, 6, '3 is strictly less than 6'); | ||
* | ||
* @name isBelow | ||
* @param {Mixed} valueToCheck | ||
* @param {Mixed} valueToBeBelow | ||
* @param {String} message | ||
* @api public | ||
*/ | ||
assert.isTrue = function (val, msg) { | ||
@@ -1021,2 +1057,21 @@ new Assertion(val, msg).is['true']; | ||
/** | ||
* ### .sameDeepMembers(set1, set2, [message]) | ||
* | ||
* Asserts that `set1` and `set2` have the same members - using a deep equality checking. | ||
* Order is not taken into account. | ||
* | ||
* assert.sameDeepMembers([ {b: 3}, {a: 2}, {c: 5} ], [ {c: 5}, {b: 3}, {a: 2} ], 'same deep members'); | ||
* | ||
* @name sameDeepMembers | ||
* @param {Array} set1 | ||
* @param {Array} set2 | ||
* @param {String} message | ||
* @api public | ||
*/ | ||
assert.sameDeepMembers = function (set1, set2, msg) { | ||
new Assertion(set1, msg).to.have.same.deep.members(set2); | ||
} | ||
/** | ||
* ### .includeMembers(superset, subset, [message]) | ||
@@ -1040,2 +1095,128 @@ * | ||
/** | ||
* ### .changes(function, object, property) | ||
* | ||
* Asserts that a function changes the value of a property | ||
* | ||
* var obj = { val: 10 }; | ||
* var fn = function() { obj.val = 22 }; | ||
* assert.changes(fn, obj, 'val'); | ||
* | ||
* @name changes | ||
* @param {Function} modifier function | ||
* @param {Object} object | ||
* @param {String} property name | ||
* @param {String} message _optional_ | ||
* @api public | ||
*/ | ||
assert.changes = function (fn, obj, prop) { | ||
new Assertion(fn).to.change(obj, prop); | ||
} | ||
/** | ||
* ### .doesNotChange(function, object, property) | ||
* | ||
* Asserts that a function does not changes the value of a property | ||
* | ||
* var obj = { val: 10 }; | ||
* var fn = function() { console.log('foo'); }; | ||
* assert.doesNotChange(fn, obj, 'val'); | ||
* | ||
* @name doesNotChange | ||
* @param {Function} modifier function | ||
* @param {Object} object | ||
* @param {String} property name | ||
* @param {String} message _optional_ | ||
* @api public | ||
*/ | ||
assert.doesNotChange = function (fn, obj, prop) { | ||
new Assertion(fn).to.not.change(obj, prop); | ||
} | ||
/** | ||
* ### .increases(function, object, property) | ||
* | ||
* Asserts that a function increases an object property | ||
* | ||
* var obj = { val: 10 }; | ||
* var fn = function() { obj.val = 13 }; | ||
* assert.increases(fn, obj, 'val'); | ||
* | ||
* @name increases | ||
* @param {Function} modifier function | ||
* @param {Object} object | ||
* @param {String} property name | ||
* @param {String} message _optional_ | ||
* @api public | ||
*/ | ||
assert.increases = function (fn, obj, prop) { | ||
new Assertion(fn).to.increase(obj, prop); | ||
} | ||
/** | ||
* ### .doesNotIncrease(function, object, property) | ||
* | ||
* Asserts that a function does not increase object property | ||
* | ||
* var obj = { val: 10 }; | ||
* var fn = function() { obj.val = 8 }; | ||
* assert.doesNotIncrease(fn, obj, 'val'); | ||
* | ||
* @name doesNotIncrease | ||
* @param {Function} modifier function | ||
* @param {Object} object | ||
* @param {String} property name | ||
* @param {String} message _optional_ | ||
* @api public | ||
*/ | ||
assert.doesNotIncrease = function (fn, obj, prop) { | ||
new Assertion(fn).to.not.increase(obj, prop); | ||
} | ||
/** | ||
* ### .decreases(function, object, property) | ||
* | ||
* Asserts that a function decreases an object property | ||
* | ||
* var obj = { val: 10 }; | ||
* var fn = function() { obj.val = 5 }; | ||
* assert.decreases(fn, obj, 'val'); | ||
* | ||
* @name decreases | ||
* @param {Function} modifier function | ||
* @param {Object} object | ||
* @param {String} property name | ||
* @param {String} message _optional_ | ||
* @api public | ||
*/ | ||
assert.decreases = function (fn, obj, prop) { | ||
new Assertion(fn).to.decrease(obj, prop); | ||
} | ||
/** | ||
* ### .doesNotDecrease(function, object, property) | ||
* | ||
* Asserts that a function does not decreases an object property | ||
* | ||
* var obj = { val: 10 }; | ||
* var fn = function() { obj.val = 15 }; | ||
* assert.doesNotDecrease(fn, obj, 'val'); | ||
* | ||
* @name doesNotDecrease | ||
* @param {Function} modifier function | ||
* @param {Object} object | ||
* @param {String} property name | ||
* @param {String} message _optional_ | ||
* @api public | ||
*/ | ||
assert.doesNotDecrease = function (fn, obj, prop) { | ||
new Assertion(fn).to.not.decrease(obj, prop); | ||
} | ||
/*! | ||
@@ -1042,0 +1223,0 @@ * Undocumented / untested |
@@ -11,3 +11,24 @@ /*! | ||
}; | ||
/** | ||
* ### .fail(actual, expected, [message], [operator]) | ||
* | ||
* Throw a failure. | ||
* | ||
* @name fail | ||
* @param {Mixed} actual | ||
* @param {Mixed} expected | ||
* @param {String} message | ||
* @param {String} operator | ||
* @api public | ||
*/ | ||
chai.expect.fail = function (actual, expected, message, operator) { | ||
message = message || 'expect.fail()'; | ||
throw new chai.AssertionError(message, { | ||
actual: actual | ||
, expected: expected | ||
, operator: operator | ||
}, chai.expect.fail); | ||
}; | ||
}; | ||
@@ -43,2 +43,24 @@ /*! | ||
/** | ||
* ### .fail(actual, expected, [message], [operator]) | ||
* | ||
* Throw a failure. | ||
* | ||
* @name fail | ||
* @param {Mixed} actual | ||
* @param {Mixed} expected | ||
* @param {String} message | ||
* @param {String} operator | ||
* @api public | ||
*/ | ||
should.fail = function (actual, expected, message, operator) { | ||
message = message || 'should.fail()'; | ||
throw new chai.AssertionError(message, { | ||
actual: actual | ||
, expected: expected | ||
, operator: operator | ||
}, should.fail); | ||
}; | ||
should.equal = function (val1, val2, msg) { | ||
@@ -45,0 +67,0 @@ new Assertion(val1, msg).to.equal(val2); |
@@ -8,3 +8,3 @@ /*! | ||
/** | ||
* ### flag(object ,key, [value]) | ||
* ### flag(object, key, [value]) | ||
* | ||
@@ -19,3 +19,3 @@ * Get or set a flag value on an object. If a | ||
* | ||
* @param {Object} object (constructed Assertion | ||
* @param {Object} object constructed Assertion | ||
* @param {String} key | ||
@@ -22,0 +22,0 @@ * @param {Mixed} value (optional) |
@@ -8,2 +8,4 @@ /*! | ||
var getPathInfo = require('./getPathInfo'); | ||
/** | ||
@@ -38,67 +40,5 @@ * ### .getPathValue(path, object) | ||
*/ | ||
var getPathValue = module.exports = function (path, obj) { | ||
var parsed = parsePath(path); | ||
return _getPathValue(parsed, obj); | ||
}; | ||
/*! | ||
* ## parsePath(path) | ||
* | ||
* Helper function used to parse string object | ||
* paths. Use in conjunction with `_getPathValue`. | ||
* | ||
* var parsed = parsePath('myobject.property.subprop'); | ||
* | ||
* ### Paths: | ||
* | ||
* * Can be as near infinitely deep and nested | ||
* * Arrays are also valid using the formal `myobject.document[3].property`. | ||
* | ||
* @param {String} path | ||
* @returns {Object} parsed | ||
* @api private | ||
*/ | ||
function parsePath (path) { | ||
var str = path.replace(/\[/g, '.[') | ||
, parts = str.match(/(\\\.|[^.]+?)+/g); | ||
return parts.map(function (value) { | ||
var re = /\[(\d+)\]$/ | ||
, mArr = re.exec(value) | ||
if (mArr) return { i: parseFloat(mArr[1]) }; | ||
else return { p: value }; | ||
}); | ||
}; | ||
/*! | ||
* ## _getPathValue(parsed, obj) | ||
* | ||
* Helper companion function for `.parsePath` that returns | ||
* the value located at the parsed address. | ||
* | ||
* var value = getPathValue(parsed, obj); | ||
* | ||
* @param {Object} parsed definition from `parsePath`. | ||
* @param {Object} object to search against | ||
* @returns {Object|Undefined} value | ||
* @api private | ||
*/ | ||
function _getPathValue (parsed, obj) { | ||
var tmp = obj | ||
, res; | ||
for (var i = 0, l = parsed.length; i < l; i++) { | ||
var part = parsed[i]; | ||
if (tmp) { | ||
if ('undefined' !== typeof part.p) | ||
tmp = tmp[part.p]; | ||
else if ('undefined' !== typeof part.i) | ||
tmp = tmp[part.i]; | ||
if (i == (l - 1)) res = tmp; | ||
} else { | ||
res = undefined; | ||
} | ||
} | ||
return res; | ||
}; | ||
module.exports = function(path, obj) { | ||
var info = getPathInfo(path, obj); | ||
return info.value; | ||
}; |
@@ -74,2 +74,14 @@ /*! | ||
/*! | ||
* Deep path info | ||
*/ | ||
exports.getPathInfo = require('./getPathInfo'); | ||
/*! | ||
* Check if a property exists | ||
*/ | ||
exports.hasProperty = require('./hasProperty'); | ||
/*! | ||
* Function name | ||
@@ -76,0 +88,0 @@ */ |
@@ -8,3 +8,3 @@ /*! | ||
/** | ||
* ### overwriteChainableMethod (ctx, name, fn) | ||
* ### overwriteChainableMethod (ctx, name, method, chainingBehavior) | ||
* | ||
@@ -11,0 +11,0 @@ * Overwites an already existing chainable method |
@@ -23,5 +23,5 @@ /*! | ||
* @param {Assertion} assertion the assertion to transfer the flags from | ||
* @param {Object} object the object to transfer the flags too; usually a new assertion | ||
* @param {Object} object the object to transfer the flags to; usually a new assertion | ||
* @param {Boolean} includeAll | ||
* @name getAllFlags | ||
* @name transferFlags | ||
* @api private | ||
@@ -28,0 +28,0 @@ */ |
@@ -5,3 +5,9 @@ { | ||
"description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic.", | ||
"keywords": [ "test", "assertion", "assert", "testing", "chai" ], | ||
"keywords": [ | ||
"test", | ||
"assertion", | ||
"assert", | ||
"testing", | ||
"chai" | ||
], | ||
"homepage": "http://chaijs.com", | ||
@@ -15,3 +21,3 @@ "license": "MIT", | ||
], | ||
"version": "1.10.0", | ||
"version": "2.0.0", | ||
"repository": { | ||
@@ -32,14 +38,14 @@ "type": "git", | ||
"dependencies": { | ||
"assertion-error": "1.0.0" | ||
, "deep-eql": "0.1.3" | ||
"assertion-error": "1.0.0", | ||
"deep-eql": "0.1.3" | ||
}, | ||
"devDependencies": { | ||
"component": "*" | ||
, "karma": "0.12.x" | ||
, "karma-mocha": "*" | ||
, "karma-sauce-launcher": "0.2.x" | ||
, "karma-phantomjs-launcher": "0.1.1" | ||
, "mocha": "1.21.x" | ||
, "istanbul": "0.2.x" | ||
"component": "*", | ||
"karma": "0.12.x", | ||
"karma-mocha": "*", | ||
"karma-sauce-launcher": "0.2.x", | ||
"karma-phantomjs-launcher": "0.1.1", | ||
"mocha": "1.21.x", | ||
"istanbul": "0.2.x" | ||
} | ||
} |
130
README.md
@@ -17,3 +17,3 @@ [![Chai Documentation](http://chaijs.com/public/img/chai-logo.png)](http://chaijs.com) | ||
- Need a plugin? View the [official plugin list](http://chaijs.com/plugins). | ||
- Have a plugin and want it listed? Open a Pull Request at [chaijs/chai-docs:plugin.js](https://github.com/chaijs/chai-docs/blob/master/plugins.js#L1-L12). | ||
- Have a plugin and want it listed? Open a Pull Request at [chaijs/chai-docs:plugin.js](https://github.com/chaijs/chai-docs/blob/master/plugins.js#L1-L12). | ||
- Want to build a plugin? Read the [plugin api documentation](http://chaijs.com/guide/plugins/). | ||
@@ -28,60 +28,72 @@ | ||
repo age : 2 years, 11 months | ||
active : 189 days | ||
commits : 792 | ||
files : 57 | ||
project : chai | ||
repo age : 3 years, 2 months | ||
active : 220 days | ||
commits : 845 | ||
files : 59 | ||
authors : | ||
551 Jake Luer 69.6% | ||
79 Veselin Todorov 10.0% | ||
43 Domenic Denicola 5.4% | ||
7 Joshua Perry 0.9% | ||
6 Ruben Verborgh 0.8% | ||
5 George Kats 0.6% | ||
5 Jo Liss 0.6% | ||
5 Juliusz Gonera 0.6% | ||
5 Scott Nonnenberg 0.6% | ||
5 leider 0.6% | ||
4 David da Silva 0.5% | ||
4 John Firebaugh 0.5% | ||
4 Max Edmands 0.5% | ||
4 Nick Heiner 0.5% | ||
4 Veselin 0.5% | ||
4 charlierudolph 0.5% | ||
4 josher19 0.5% | ||
3 Andrei Neculau 0.4% | ||
3 Duncan Beevers 0.4% | ||
3 Jake Rosoman 0.4% | ||
3 Jeff Barczewski 0.4% | ||
3 Keith Cirkel 0.4% | ||
3 Ryunosuke SATO 0.4% | ||
2 Bartvds 0.3% | ||
2 Edwin Shao 0.3% | ||
2 Jakub Nešetřil 0.3% | ||
2 Roman Masek 0.3% | ||
2 Teddy Cross 0.3% | ||
1 Anand Patil 0.1% | ||
1 Benjamin Horsleben 0.1% | ||
1 Brandon Payton 0.1% | ||
1 Chris Connelly 0.1% | ||
1 Chris Thompson 0.1% | ||
1 Christopher Hiller 0.1% | ||
1 Chun-Yi 0.1% | ||
1 DD 0.1% | ||
1 Dido Arellano 0.1% | ||
1 Jeff Welch 0.1% | ||
1 Julien Wajsberg 0.1% | ||
1 Kilian Ciuffolo 0.1% | ||
1 Luís Cardoso 0.1% | ||
1 Martin Middel 0.1% | ||
1 Niklas Närhinen 0.1% | ||
1 Paul Miller 0.1% | ||
1 Refael Ackermann 0.1% | ||
1 Sasha Koss 0.1% | ||
1 Victor Costan 0.1% | ||
1 Vinay Pulim 0.1% | ||
1 Virginie BARDALES 0.1% | ||
1 laconbass 0.1% | ||
1 mohayonao 0.1% | ||
1 piecioshka 0.1% | ||
1 shinnn 0.1% | ||
553 Jake Luer 65.4% | ||
79 Veselin Todorov 9.3% | ||
43 Domenic Denicola 5.1% | ||
23 Keith Cirkel 2.7% | ||
14 Joshua Perry 1.7% | ||
8 Chris Polis 0.9% | ||
6 Ruben Verborgh 0.7% | ||
5 Scott Nonnenberg 0.6% | ||
5 George Kats 0.6% | ||
5 Juliusz Gonera 0.6% | ||
5 leider 0.6% | ||
5 Jo Liss 0.6% | ||
4 Chris Jones 0.5% | ||
4 David da Silva 0.5% | ||
4 Nick Heiner 0.5% | ||
4 John Firebaugh 0.5% | ||
4 Veselin 0.5% | ||
4 Max Edmands 0.5% | ||
4 charlierudolph 0.5% | ||
4 josher19 0.5% | ||
3 Jake Rosoman 0.4% | ||
3 Jeff Barczewski 0.4% | ||
3 Andrei Neculau 0.4% | ||
3 Duncan Beevers 0.4% | ||
3 Jason Karns 0.4% | ||
3 Ryunosuke SATO 0.4% | ||
2 Gregg Lind 0.2% | ||
2 Teddy Cross 0.2% | ||
2 Bartvds 0.2% | ||
2 Jakub Nešetřil 0.2% | ||
2 Edwin Shao 0.2% | ||
2 Roman Masek 0.2% | ||
1 toastynerd 0.1% | ||
1 Anand Patil 0.1% | ||
1 Benjamin Horsleben 0.1% | ||
1 Brandon Payton 0.1% | ||
1 Chasen Le Hara 0.1% | ||
1 Chris Connelly 0.1% | ||
1 Chris Thompson 0.1% | ||
1 Christopher Hiller 0.1% | ||
1 Chun-Yi 0.1% | ||
1 DD 0.1% | ||
1 Danilo Vaz 0.1% | ||
1 Dido Arellano 0.1% | ||
1 Jeff Welch 0.1% | ||
1 Julien Wajsberg 0.1% | ||
1 Kilian Ciuffolo 0.1% | ||
1 Luís Cardoso 0.1% | ||
1 Martin Middel 0.1% | ||
1 Mathias Schreck 0.1% | ||
1 Michael Lange 0.1% | ||
1 Niklas Närhinen 0.1% | ||
1 Paul Miller 0.1% | ||
1 Refael Ackermann 0.1% | ||
1 Sasha Koss 0.1% | ||
1 Victor Costan 0.1% | ||
1 Vinay Pulim 0.1% | ||
1 Virginie BARDALES 0.1% | ||
1 ericdouglas 0.1% | ||
1 laconbass 0.1% | ||
1 mohayonao 0.1% | ||
1 piecioshka 0.1% | ||
1 shinnn 0.1% | ||
1 Adam Hull 0.1% | ||
@@ -93,3 +105,3 @@ | ||
Copyright (c) 2011-2014 Jake Luer <jake@alogicalparadox.com> | ||
Copyright (c) 2011-2015 Jake Luer <jake@alogicalparadox.com> | ||
@@ -96,0 +108,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
# Release Notes | ||
## 1.10.0 / 2014-11-10 | ||
## 2.0.0 / 2015-02-09 | ||
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](https://www.npmjs.com/package/dirty-chai) | ||
by [@joshperry](https://github.com/joshperry) | ||
### Community Contributions | ||
#### Code Features & Fixes | ||
* [#361](https://github.com/chaijs/chai/pull/361) `.keys()` now accepts Objects, extracting keys from them. By [@gregglind](https://github.com/gregglind) | ||
* [#359](https://github.com/chaijs/chai/pull/359) `.keys()` no longer mutates passed arrays. By [@gregglind](https://github.com/gregglind) | ||
* [#349](https://github.com/chaijs/chai/pull/349) Add a new chainable keyword - `.which`. By [@toastynerd](https://github.com/toastynerd) | ||
* [#333](https://github.com/chaijs/chai/pull/333) Add `.change`, `.increase` and `.decrease` assertions. By [@cmpolis](https://github.com/cmpolis) | ||
* [#335](https://github.com/chaijs/chai/pull/335) `chai.util` is now exposed [@DingoEatingFuzz](https://github.com/DingoEatingFuzz) | ||
* [#328](https://github.com/chaijs/chai/pull/328) Add `.includes` and `.contains` aliases (for `.include` and `.contain`). By [@lo1tuma](https://github.com/lo1tuma) | ||
* [#313](https://github.com/chaijs/chai/pull/313) Add `.any.keys()` and `.all.keys()` qualifiers. By [@cjqed](https://github.com/cjqed) | ||
* [#312](https://github.com/chaijs/chai/pull/312) Add `assert.sameDeepMembers()`. By [@cjqed](https://github.com/cjqed) | ||
* [#311](https://github.com/chaijs/chai/pull/311) Add `assert.isAbove()` and `assert.isBelow()`. By [@cjqed](https://github.com/cjqed) | ||
* [#308](https://github.com/chaijs/chai/pull/308) `property` and `deep.property` now pass if a value is set to `undefined`. By [@prodatakey](https://github.com/prodatakey) | ||
* [#309](https://github.com/chaijs/chai/pull/309) optimize deep equal in Arrays. By [@ericdouglas](https://github.com/ericdouglas) | ||
* [#306](https://github.com/chaijs/chai/pull/306) revert #297 - allowing lint-friendly tests. By [@keithamus](https://github.com/keithamus) | ||
#### Documentation fixes | ||
* [#357](https://github.com/chaijs/chai/pull/357) Copyright year updated in docs. By [@danilovaz](https://github.com/danilovaz) | ||
* [#325](https://github.com/chaijs/chai/pull/325) Fix documentation for overwriteChainableMethod. By [@chasenlehara](https://github.com/chasenlehara) | ||
* [#334](https://github.com/chaijs/chai/pull/334) Typo fix. By [@hurrymaplelad](https://github.com/hurrymaplelad) | ||
* [#317](https://github.com/chaijs/chai/pull/317) Typo fix. By [@jasonkarns](https://github.com/jasonkarns) | ||
* [#318](https://github.com/chaijs/chai/pull/318) Typo fix. By [@jasonkarns](https://github.com/jasonkarns) | ||
* [#316](https://github.com/chaijs/chai/pull/316) Typo fix. By [@jasonkarns](https://github.com/jasonkarns) | ||
## 1.10.0 / 2014-11-10 | ||
The following changes are required if you are upgrading from the previous version: | ||
@@ -9,6 +46,6 @@ | ||
- No changes required | ||
- **Plugin Developers:** | ||
- **Plugin Developers:** | ||
- Review `addChainableNoop` notes below. | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated dependencies. | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated dependencies. | ||
@@ -29,4 +66,4 @@ ### Noop Function for Terminating Assertion Properties | ||
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 | ||
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. | ||
@@ -39,16 +76,16 @@ | ||
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, | ||
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 | ||
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 | ||
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. | ||
@@ -71,7 +108,7 @@ | ||
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 | ||
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. | ||
@@ -87,3 +124,3 @@ | ||
## 1.9.2 / 2014-09-29 | ||
## 1.9.2 / 2014-09-29 | ||
@@ -94,6 +131,6 @@ The following changes are required if you are upgrading from the previous version: | ||
- No changes required | ||
- **Plugin Developers:** | ||
- **Plugin Developers:** | ||
- No changes required | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated dependencies. | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated dependencies. | ||
@@ -114,3 +151,3 @@ ### Community Contributions | ||
## 1.9.1 / 2014-03-19 | ||
## 1.9.1 / 2014-03-19 | ||
@@ -121,6 +158,6 @@ The following changes are required if you are upgrading from the previous version: | ||
- Migrate configuration options to new interface. (see notes) | ||
- **Plugin Developers:** | ||
- **Plugin Developers:** | ||
- No changes required | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated dependencies. | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated dependencies. | ||
@@ -130,9 +167,9 @@ ### 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 | ||
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` | ||
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 | ||
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. | ||
@@ -159,4 +196,4 @@ | ||
User configurable property, influences whether stack trace is included in | ||
Assertion error message. Default of `false` suppresses stack trace in the error | ||
User configurable property, influences whether stack trace is included in | ||
Assertion error message. Default of `false` suppresses stack trace in the error | ||
message. | ||
@@ -169,4 +206,4 @@ | ||
User configurable property, influences whether or not the `showDiff` flag | ||
should be included in the thrown AssertionErrors. `false` will always be `false`; | ||
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. | ||
@@ -179,3 +216,3 @@ | ||
User configurable property, sets length threshold for actual and expected values | ||
User configurable property, sets length threshold for actual and expected values | ||
in assertion errors. If this threshold is exceeded, the value is truncated. | ||
@@ -204,3 +241,3 @@ | ||
## 1.9.0 / 2014-01-29 | ||
## 1.9.0 / 2014-01-29 | ||
@@ -211,6 +248,6 @@ The following changes are required if you are upgrading from the previous version: | ||
- No changes required | ||
- **Plugin Developers:** | ||
- **Plugin Developers:** | ||
- Review [#219](https://github.com/chaijs/chai/pull/219). | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated dependencies. | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated dependencies. | ||
@@ -237,3 +274,3 @@ ### Community Contributions | ||
## 1.8.1 / 2013-10-10 | ||
## 1.8.1 / 2013-10-10 | ||
@@ -243,7 +280,7 @@ The following changes are required if you are upgrading from the previous version: | ||
- **Users:** | ||
- Refresh `node_modules` folder for updated dependencies. | ||
- **Plugin Developers:** | ||
- Refresh `node_modules` folder for updated dependencies. | ||
- **Plugin Developers:** | ||
- No changes required | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated dependencies. | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated dependencies. | ||
@@ -255,3 +292,3 @@ ### Browserify | ||
## 1.8.0 / 2013-09-18 | ||
## 1.8.0 / 2013-09-18 | ||
@@ -262,6 +299,6 @@ The following changes are required if you are upgrading from the previous version: | ||
- See `deep.equal` notes. | ||
- **Plugin Developers:** | ||
- **Plugin Developers:** | ||
- No changes required | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated dependencies. | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated dependencies. | ||
@@ -271,8 +308,8 @@ ### Deep Equals | ||
This version of Chai focused on a overhaul to the deep equal utility. The code for this | ||
tool has been removed from the core lib and can now be found at: | ||
tool has been removed from the core lib and can now be found at: | ||
[chai / deep-eql](https://github.com/chaijs/deep-eql). As stated in previous releases, | ||
this is part of a larger initiative to provide transparency, independent testing, and coverage for | ||
some of the more complicated internal tools. | ||
some of the more complicated internal tools. | ||
For the most part `.deep.equal` will behave the same as it has. However, in order to provide a | ||
For the most part `.deep.equal` will behave the same as it has. However, in order to provide a | ||
consistent ruleset across all types being tested, the following changes have been made and _might_ | ||
@@ -305,3 +342,3 @@ require changes to your tests. | ||
Chai now runs the browser CI suite using [Karma](http://karma-runner.github.io/) directed at | ||
Chai now runs the browser CI suite using [Karma](http://karma-runner.github.io/) directed at | ||
[SauceLabs](https://saucelabs.com/). This means we get to know where our browser support stands... | ||
@@ -316,3 +353,3 @@ and we get a cool badge: | ||
## 1.7.2 / 2013-06-27 | ||
## 1.7.2 / 2013-06-27 | ||
@@ -323,6 +360,6 @@ The following changes are required if you are upgrading from the previous version: | ||
- No changes required. | ||
- **Plugin Developers:** | ||
- **Plugin Developers:** | ||
- No changes required | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated dependencies. | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated dependencies. | ||
@@ -334,3 +371,3 @@ ### Coverage Reporting | ||
the [coveralls.io](https://coveralls.io/) service. A badge has been added to the README and the full report | ||
can be viewed online at the [chai coveralls project](https://coveralls.io/r/chaijs/chai). Furthermore, PRs | ||
can be viewed online at the [chai coveralls project](https://coveralls.io/r/chaijs/chai). Furthermore, PRs | ||
will receive automated messages indicating how their PR impacts test coverage. This service is tied to TravisCI. | ||
@@ -342,3 +379,3 @@ | ||
## 1.7.1 / 2013-06-24 | ||
## 1.7.1 / 2013-06-24 | ||
@@ -349,6 +386,6 @@ The following changes are required if you are upgrading from the previous version: | ||
- No changes required. | ||
- **Plugin Developers:** | ||
- **Plugin Developers:** | ||
- No changes required | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated dependencies. | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated dependencies. | ||
@@ -359,7 +396,7 @@ ### Official Bower Support | ||
Chai could be installed via Bower in the past, this update adds official support via the `bower.json` | ||
specification file. | ||
specification file. | ||
- [#175](https://github.com/chaijs/chai/issues/175) Add `bower.json`. | ||
## 1.7.0 / 2013-06-17 | ||
## 1.7.0 / 2013-06-17 | ||
@@ -370,6 +407,6 @@ The following changes are required if you are upgrading from the previous version: | ||
- No changes required. | ||
- **Plugin Developers:** | ||
- **Plugin Developers:** | ||
- Review AssertionError update notice. | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated dependencies. | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated dependencies. | ||
@@ -379,7 +416,7 @@ ### AssertionError Update Notice | ||
Chai now uses [chaijs/assertion-error](https://github.com/chaijs/assertion-error) instead an internal | ||
constructor. This will allow for further iteration/experimentation of the AssertionError constructor | ||
independant of Chai. Future plans include stack parsing for callsite support. | ||
constructor. This will allow for further iteration/experimentation of the AssertionError constructor | ||
independant of Chai. Future plans include stack parsing for callsite support. | ||
This update constructor has a different constructor param signature that conforms more with the standard | ||
`Error` object. If your plugin throws and `AssertionError` directly you will need to update your plugin | ||
`Error` object. If your plugin throws and `AssertionError` directly you will need to update your plugin | ||
with the new signature. | ||
@@ -428,3 +465,3 @@ | ||
there is an higher need for accountability and documentation. External dependencies will allow us to iterate and | ||
test on features independent from our interfaces. | ||
test on features independent from our interfaces. | ||
@@ -441,3 +478,3 @@ Note: The browser packaged version `chai.js` will ALWAYS contain all dependencies needed to run Chai. | ||
## 1.6.1 / 2013-06-05 | ||
## 1.6.1 / 2013-06-05 | ||
@@ -448,6 +485,6 @@ The following changes are required if you are upgrading from the previous version: | ||
- No changes required. | ||
- **Plugin Developers:** | ||
- **Plugin Developers:** | ||
- No changes required. | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated developement dependencies. | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated developement dependencies. | ||
@@ -470,3 +507,3 @@ ### Deep Equality | ||
## 1.6.0 / 2013-04-29 | ||
## 1.6.0 / 2013-04-29 | ||
@@ -477,6 +514,6 @@ The following changes are required if you are upgrading from the previous version: | ||
- No changes required. | ||
- **Plugin Developers:** | ||
- **Plugin Developers:** | ||
- No changes required. | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated developement dependencies. | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated developement dependencies. | ||
@@ -502,3 +539,3 @@ ### New Assertions | ||
// (assert) inclusion | ||
// (assert) inclusion | ||
assert.includeMembers([ 1, 2, 3 ], [ 2, 1 ], 'include members'); | ||
@@ -510,3 +547,3 @@ | ||
Most `assert` functions have a negative version, like `instanceOf()` has a corresponding `notInstaceOf()`. | ||
Most `assert` functions have a negative version, like `instanceOf()` has a corresponding `notInstaceOf()`. | ||
However `include()` did not have a corresponding `notInclude()`. This has been added. | ||
@@ -532,3 +569,3 @@ | ||
## 1.5.0 / 2013-02-03 | ||
## 1.5.0 / 2013-02-03 | ||
@@ -539,9 +576,9 @@ ### Migration Requirements | ||
- **Users:** | ||
- _Update [2013-02-04]:_ Some users may notice a small subset of deep equality assertions will no longer pass. This is the result of | ||
- **Users:** | ||
- _Update [2013-02-04]:_ Some users may notice a small subset of deep equality assertions will no longer pass. This is the result of | ||
[#120](https://github.com/chaijs/chai/issues/120), an improvement to our deep equality algorithm. Users will need to revise their assertions | ||
to be more granular should this occur. Further information: [#139](https://github.com/chaijs/chai/issues/139). | ||
- **Plugin Developers:** | ||
- **Plugin Developers:** | ||
- No changes required. | ||
- **Core Contributors:** | ||
- **Core Contributors:** | ||
- Refresh `node_modules` folder for updated developement dependencies. | ||
@@ -570,6 +607,6 @@ | ||
**1. Component Support:** Chai now included the proper configuration to be installed as a | ||
**1. Component Support:** Chai now included the proper configuration to be installed as a | ||
[component](https://github.com/component/component). Component users are encouraged to consult | ||
[chaijs.com](http://chaijs.com) for the latest version number as using the master branch | ||
does not gaurantee stability. | ||
does not gaurantee stability. | ||
@@ -587,5 +624,5 @@ ```js | ||
**2. Configurable showDiff:** Some test runners (such as [mocha](http://visionmedia.github.com/mocha/)) | ||
include support for showing the diff of strings and objects when an equality error occurs. Chai has | ||
already included support for this, however some users may not prefer this display behavior. To revert to | ||
**2. Configurable showDiff:** Some test runners (such as [mocha](http://visionmedia.github.com/mocha/)) | ||
include support for showing the diff of strings and objects when an equality error occurs. Chai has | ||
already included support for this, however some users may not prefer this display behavior. To revert to | ||
no diff display, the following configuration is available: | ||
@@ -600,3 +637,3 @@ | ||
**1. New Utility - type**: The new utility `.type()` is available as a better implementation of `typeof` | ||
**1. New Utility - type**: The new utility `.type()` is available as a better implementation of `typeof` | ||
that can be used cross-browser. It handles the inconsistencies of Array, `null`, and `undefined` detection. | ||
@@ -619,5 +656,5 @@ | ||
**1. Browser Testing**: Browser testing of the `./chai.js` file is now available in the command line | ||
via PhantomJS. `make test` and Travis-CI will now also rebuild and test `./chai.js`. Consequently, all | ||
pull requests will now be browser tested in this way. | ||
**1. Browser Testing**: Browser testing of the `./chai.js` file is now available in the command line | ||
via PhantomJS. `make test` and Travis-CI will now also rebuild and test `./chai.js`. Consequently, all | ||
pull requests will now be browser tested in this way. | ||
@@ -624,0 +661,0 @@ _Note: Contributors opening pull requests should still NOT include the browser build._ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
333569
40
8818
122