From 2abd737618bedfa01bcacf5d7f0a767bdcb9eb45 Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Sun, 26 Apr 2015 17:13:17 +0100 Subject: [PATCH] Release 2.3.0 --- .travis.yml | 6 ++-- History.md | 14 +++++++++ README.md | 83 +++++++++++++++++++++++++------------------------ ReleaseNotes.md | 31 ++++++++++++++++++ bower.json | 2 +- chai.js | 79 +++++++++++++++++++++++++++++++++++++--------- component.json | 2 +- lib/chai.js | 2 +- package.json | 2 +- 9 files changed, 160 insertions(+), 61 deletions(-) diff --git a/.travis.yml b/.travis.yml index df59fadea..cec5bcecd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +sudo: false language: node_js node_js: - 0.1 @@ -14,9 +15,10 @@ env: deploy: provider: npm - email: jake@alogicalparadox.com + email: + secure: "M9J56tqJwOxn6D3PSh8BNGac/8XjTCRGCFexN5QFl7Ha9AKnyQTy1ZAaJonMGoClBhh37Dy/89wVWmqg4NPckrD5Ej7NvwhTjVfEHusllaCROqVu5m7ijS3WKlIxM/xtBzU7SqRY41JxloP+CLKxRiKRWQJDvgwUZW7OHdmAkAY=" api_key: - secure: AgNQTECM/3Gh0q77gkrMx0jASgRh/dysPdUf7Zdsm1k9Gt+i4H99k2L8lVWqpLF1+e6lhWg9w4C08Xgz6tuOTPZZr6UzeRDl+ZjniTYK3E/tpcUbqAQxxgD4b3iA6BLbF0YKGofnWrMtXBBWI8X0jekxncu7sWdBuieyhg33fik= + secure: "bH1U+PiDXBwvI5M2NQMhxYmTc2Ugl9Nfw3AEttsJaBreAjCPkue6Iusr1W9QeHMOytKDDX7M1anLqrn7XpokfNkG7Jqeh1mlkdK+qlTrB1lOsiZ7hbdYH/dOUYITzm7NRTjzg4i9oIuIPOTGYvsvipbatDdCKSK+8iKxX5EBtiQ=" on: tags: true repo: chaijs/chai diff --git a/History.md b/History.md index 45e352e25..fbb6dcea3 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,17 @@ +2.3.0 / 2015-04-26 +================== + + * Merge pull request #423 from ehntoo/patch-1 + * Merge pull request #422 from ljharb/fix_descriptor_tests + * Fix a small bug in the .null assertion docs + * Use a regex to account for property ordering issues across engines. + * Add `make test-firefox` + * Merge pull request #417 from astorije/astorije/minimalist-typo + * Remove trailing whitespaces + * Fix super minor typo in an example + * Merge pull request #408 from ljharb/enumerableProperty + * Add `ownPropertyDescriptor` assertion. + 2.2.0 / 2015-03-26 ================== diff --git a/README.md b/README.md index 230a38722..4dfdc960e 100644 --- a/README.md +++ b/README.md @@ -25,82 +25,85 @@ Chai offers a robust Plugin architecture for extending Chai's assertions and int ### Contributors project : chai - repo age : 3 years, 3 months - active : 232 days - commits : 879 + repo age : 3 years, 5 months + active : 244 days + commits : 900 files : 59 authors : - 555 Jake Luer 63.1% - 79 Veselin Todorov 9.0% - 43 Domenic Denicola 4.9% - 41 Keith Cirkel 4.7% + 555 Jake Luer 61.7% + 79 Veselin Todorov 8.8% + 52 Keith Cirkel 5.8% + 43 Domenic Denicola 4.8% 14 Joshua Perry 1.6% 8 Chris Polis 0.9% 6 Ruben Verborgh 0.7% 6 Ian Zamojc 0.7% - 5 leider 0.6% 5 George Kats 0.6% + 5 leider 0.6% 5 Scott Nonnenberg 0.6% - 5 Jo Liss 0.6% 5 Juliusz Gonera 0.6% - 4 Veselin 0.5% - 4 Nick Heiner 0.5% - 4 David da Silva 0.5% - 4 Chris Jones 0.5% - 4 josher19 0.5% - 4 John Firebaugh 0.5% - 4 Max Edmands 0.5% - 4 charlierudolph 0.5% + 5 Jo Liss 0.6% + 4 Jérémie Astori 0.4% + 4 John Firebaugh 0.4% + 4 charlierudolph 0.4% + 4 Veselin 0.4% + 4 Chris Jones 0.4% + 4 Nick Heiner 0.4% + 4 Max Edmands 0.4% + 4 David da Silva 0.4% + 4 Kaito Udagawa 0.4% + 4 josher19 0.4% + 3 Jordan Harband 0.3% 3 Ryunosuke SATO 0.3% + 3 Jake Rosoman 0.3% + 3 Duncan Beevers 0.3% 3 Jason Karns 0.3% 3 Jeff Barczewski 0.3% 3 Andrei Neculau 0.3% - 3 Duncan Beevers 0.3% - 3 Jake Rosoman 0.3% - 2 Teddy Cross 0.2% + 2 eldritch fossicker 0.2% 2 Bartvds 0.2% 2 Edwin Shao 0.2% 2 Gregg Lind 0.2% - 2 Roman Masek 0.2% - 2 Jérémie Astori 0.2% 2 Jakub Nešetřil 0.2% - 2 eldritch fossicker 0.2% - 1 Adam Hull 0.1% - 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 Doug Neiner 0.1% - 1 Jeff Welch 0.1% + 2 Roman Masek 0.2% + 2 Teddy Cross 0.2% 1 Jesse McCarthy 0.1% - 1 Julien Wajsberg 0.1% + 1 Doug Neiner 0.1% + 1 Dido Arellano 0.1% 1 Kilian Ciuffolo 0.1% 1 Luís Cardoso 0.1% 1 Martin Middel 0.1% 1 Mathias Schreck 0.1% + 1 Danilo Vaz 0.1% 1 Michael Lange 0.1% + 1 Mitchell Johnson 0.1% + 1 DD 0.1% 1 Niklas Närhinen 0.1% 1 Paul Miller 0.1% 1 Refael Ackermann 0.1% + 1 shinnn 0.1% + 1 Chun-Yi 0.1% + 1 Christopher Hiller 0.1% 1 Sasha Koss 0.1% + 1 Chris Thompson 0.1% + 1 toastynerd 0.1% + 1 Chris Connelly 0.1% + 1 Chasen Le Hara 0.1% 1 Victor Costan 0.1% 1 Vinay Pulim 0.1% 1 Virginie BARDALES 0.1% 1 Vlad GURDIGA 0.1% + 1 Brandon Payton 0.1% + 1 Adam Hull 0.1% 1 ericdouglas 0.1% + 1 Benjamin Horsleben 0.1% 1 laconbass 0.1% + 1 Anand Patil 0.1% 1 mohayonao 0.1% 1 piecioshka 0.1% 1 root 0.1% - 1 shinnn 0.1% + 1 Julien Wajsberg 0.1% + 1 Jeff Welch 0.1% ## License diff --git a/ReleaseNotes.md b/ReleaseNotes.md index ffa6027f3..28f2c8810 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -1,5 +1,36 @@ # Release Notes +## 2.3.0 / 2015-04-26 + +Added `ownPropertyDescriptor` assertion: + +```js +expect('test').to.have.ownPropertyDescriptor('length'); +expect('test').to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 }); +expect('test').not.to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 }); +expect('test').ownPropertyDescriptor('length').to.have.property('enumerable', false); +expect('test').ownPropertyDescriptor('length').to.have.keys('value'); +``` + +### Community Contributions + +#### Code Features & Fixes + + * [#408](https://github.com/chaijs/chai/pull/408) Add `ownPropertyDescriptor` + assertion. + By [@ljharb](https://github.com/ljharb) + * [#422](https://github.com/chaijs/chai/pull/422) Improve ownPropertyDescriptor + tests. + By [@ljharb](https://github.com/ljharb) + +#### Documentation fixes + + * [#417](https://github.com/chaijs/chai/pull/417) Fix documentation typo + By [@astorije](https://github.com/astorije) + * [#423](https://github.com/chaijs/chai/pull/423) Fix inconsistency in docs. + By [@ehntoo](https://github.com/ehntoo) + + ## 2.2.0 / 2015-03-26 Deep property strings can now be escaped using `\\` - for example: diff --git a/bower.json b/bower.json index 8465f5d9d..9a2c4ce08 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "chai", - "version": "2.2.0", + "version": "2.3.0", "description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic.", "license": "MIT", "keywords": [ diff --git a/chai.js b/chai.js index 8139cd164..24eaab9a0 100644 --- a/chai.js +++ b/chai.js @@ -678,7 +678,7 @@ var used = [] * Chai version */ -exports.version = '2.2.0'; +exports.version = '2.3.0'; /*! * Assertion Error @@ -1051,7 +1051,7 @@ module.exports = function (chai, _) { * ### .any * * Sets the `any` flag, (opposite of the `all` flag) - * later used in the `keys` assertion. + * later used in the `keys` assertion. * * expect(foo).to.have.any.keys('bar', 'baz'); * @@ -1068,7 +1068,7 @@ module.exports = function (chai, _) { /** * ### .all * - * Sets the `all` flag (opposite of the `any` flag) + * Sets the `all` flag (opposite of the `any` flag) * later used by the `keys` assertion. * * expect(foo).to.have.all.keys('bar', 'baz'); @@ -1249,7 +1249,7 @@ module.exports = function (chai, _) { * Asserts that the target is `null`. * * expect(null).to.be.null; - * expect(undefined).not.to.be.null; + * expect(undefined).to.not.be.null; * * @name null * @api public @@ -1725,7 +1725,7 @@ module.exports = function (chai, _) { * green: { tea: 'matcha' } * , teas: [ 'chai', 'matcha', { tea: 'konacha' } ] * }; - * + * * expect(deepObj).to.have.deep.property('green.tea', 'matcha'); * expect(deepObj).to.have.deep.property('teas[1]', 'matcha'); * expect(deepObj).to.have.deep.property('teas[2].tea', 'konacha'); @@ -1846,6 +1846,55 @@ module.exports = function (chai, _) { Assertion.addMethod('ownProperty', assertOwnProperty); Assertion.addMethod('haveOwnProperty', assertOwnProperty); + /** + * ### .ownPropertyDescriptor(name[, descriptor[, message]]) + * + * Asserts that the target has an own property descriptor `name`, that optionally matches `descriptor`. + * + * 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'); + * + * @name ownPropertyDescriptor + * @alias haveOwnPropertyDescriptor + * @param {String} name + * @param {Object} descriptor _optional_ + * @param {String} message _optional_ + * @api public + */ + + function assertOwnPropertyDescriptor (name, descriptor, msg) { + if (typeof descriptor === 'string') { + msg = descriptor; + descriptor = null; + } + if (msg) flag(this, 'message', msg); + var obj = flag(this, 'object'); + var actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name); + if (actualDescriptor && descriptor) { + this.assert( + _.eql(descriptor, actualDescriptor) + , 'expected the own property descriptor for ' + _.inspect(name) + ' on #{this} to match ' + _.inspect(descriptor) + ', got ' + _.inspect(actualDescriptor) + , 'expected the own property descriptor for ' + _.inspect(name) + ' on #{this} to not match ' + _.inspect(descriptor) + , descriptor + , actualDescriptor + , true + ); + } else { + this.assert( + actualDescriptor + , 'expected #{this} to have an own property descriptor for ' + _.inspect(name) + , 'expected #{this} to not have an own property descriptor for ' + _.inspect(name) + ); + } + flag(this, 'object', actualDescriptor); + } + + Assertion.addMethod('ownPropertyDescriptor', assertOwnPropertyDescriptor); + Assertion.addMethod('haveOwnPropertyDescriptor', assertOwnPropertyDescriptor); + /** * ### .length(value) * @@ -1947,30 +1996,30 @@ module.exports = function (chai, _) { * ### .keys(key1, [key2], [...]) * * Asserts that the target contains any or all of the passed-in keys. - * Use in combination with `any`, `all`, `contains`, or `have` will affect + * 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 + * + * 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 + * + * 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 + * 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 }).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}}]); * diff --git a/component.json b/component.json index 744a7868a..91b6cd686 100644 --- a/component.json +++ b/component.json @@ -1,7 +1,7 @@ { "name": "chai" , "repo": "chaijs/chai" - , "version": "2.2.0" + , "version": "2.3.0" , "description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic." , "license": "MIT" , "keywords": [ diff --git a/lib/chai.js b/lib/chai.js index 4a9ae2403..ecaf3eb4f 100644 --- a/lib/chai.js +++ b/lib/chai.js @@ -11,7 +11,7 @@ var used = [] * Chai version */ -exports.version = '2.2.0'; +exports.version = '2.3.0'; /*! * Assertion Error diff --git a/package.json b/package.json index 208900205..7cc531fcf 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "Veselin Todorov ", "John Firebaugh " ], - "version": "2.2.0", + "version": "2.3.0", "repository": { "type": "git", "url": "https://github.com/chaijs/chai"