Skip to content

Commit 3de5502

Browse files
committed
Merge pull request #431 from keithamus/release-2.3.0
Release 2.3.0
2 parents b8807a2 + 2abd737 commit 3de5502

9 files changed

+160
-61
lines changed

.travis.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
sudo: false
12
language: node_js
23
node_js:
34
- 0.1
@@ -14,9 +15,10 @@ env:
1415

1516
deploy:
1617
provider: npm
17-
18+
email:
19+
secure: "M9J56tqJwOxn6D3PSh8BNGac/8XjTCRGCFexN5QFl7Ha9AKnyQTy1ZAaJonMGoClBhh37Dy/89wVWmqg4NPckrD5Ej7NvwhTjVfEHusllaCROqVu5m7ijS3WKlIxM/xtBzU7SqRY41JxloP+CLKxRiKRWQJDvgwUZW7OHdmAkAY="
1820
api_key:
19-
secure: AgNQTECM/3Gh0q77gkrMx0jASgRh/dysPdUf7Zdsm1k9Gt+i4H99k2L8lVWqpLF1+e6lhWg9w4C08Xgz6tuOTPZZr6UzeRDl+ZjniTYK3E/tpcUbqAQxxgD4b3iA6BLbF0YKGofnWrMtXBBWI8X0jekxncu7sWdBuieyhg33fik=
21+
secure: "bH1U+PiDXBwvI5M2NQMhxYmTc2Ugl9Nfw3AEttsJaBreAjCPkue6Iusr1W9QeHMOytKDDX7M1anLqrn7XpokfNkG7Jqeh1mlkdK+qlTrB1lOsiZ7hbdYH/dOUYITzm7NRTjzg4i9oIuIPOTGYvsvipbatDdCKSK+8iKxX5EBtiQ="
2022
on:
2123
tags: true
2224
repo: chaijs/chai

History.md

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
2.3.0 / 2015-04-26
2+
==================
3+
4+
* Merge pull request #423 from ehntoo/patch-1
5+
* Merge pull request #422 from ljharb/fix_descriptor_tests
6+
* Fix a small bug in the .null assertion docs
7+
* Use a regex to account for property ordering issues across engines.
8+
* Add `make test-firefox`
9+
* Merge pull request #417 from astorije/astorije/minimalist-typo
10+
* Remove trailing whitespaces
11+
* Fix super minor typo in an example
12+
* Merge pull request #408 from ljharb/enumerableProperty
13+
* Add `ownPropertyDescriptor` assertion.
14+
115
2.2.0 / 2015-03-26
216
==================
317

README.md

+43-40
Original file line numberDiff line numberDiff line change
@@ -25,82 +25,85 @@ Chai offers a robust Plugin architecture for extending Chai's assertions and int
2525
### Contributors
2626

2727
project : chai
28-
repo age : 3 years, 3 months
29-
active : 232 days
30-
commits : 879
28+
repo age : 3 years, 5 months
29+
active : 244 days
30+
commits : 900
3131
files : 59
3232
authors :
33-
555 Jake Luer 63.1%
34-
79 Veselin Todorov 9.0%
35-
43 Domenic Denicola 4.9%
36-
41 Keith Cirkel 4.7%
33+
555 Jake Luer 61.7%
34+
79 Veselin Todorov 8.8%
35+
52 Keith Cirkel 5.8%
36+
43 Domenic Denicola 4.8%
3737
14 Joshua Perry 1.6%
3838
8 Chris Polis 0.9%
3939
6 Ruben Verborgh 0.7%
4040
6 Ian Zamojc 0.7%
41-
5 leider 0.6%
4241
5 George Kats 0.6%
42+
5 leider 0.6%
4343
5 Scott Nonnenberg 0.6%
44-
5 Jo Liss 0.6%
4544
5 Juliusz Gonera 0.6%
46-
4 Veselin 0.5%
47-
4 Nick Heiner 0.5%
48-
4 David da Silva 0.5%
49-
4 Chris Jones 0.5%
50-
4 josher19 0.5%
51-
4 John Firebaugh 0.5%
52-
4 Max Edmands 0.5%
53-
4 charlierudolph 0.5%
45+
5 Jo Liss 0.6%
46+
4 Jérémie Astori 0.4%
47+
4 John Firebaugh 0.4%
48+
4 charlierudolph 0.4%
49+
4 Veselin 0.4%
50+
4 Chris Jones 0.4%
51+
4 Nick Heiner 0.4%
52+
4 Max Edmands 0.4%
53+
4 David da Silva 0.4%
54+
4 Kaito Udagawa 0.4%
55+
4 josher19 0.4%
56+
3 Jordan Harband 0.3%
5457
3 Ryunosuke SATO 0.3%
58+
3 Jake Rosoman 0.3%
59+
3 Duncan Beevers 0.3%
5560
3 Jason Karns 0.3%
5661
3 Jeff Barczewski 0.3%
5762
3 Andrei Neculau 0.3%
58-
3 Duncan Beevers 0.3%
59-
3 Jake Rosoman 0.3%
60-
2 Teddy Cross 0.2%
63+
2 eldritch fossicker 0.2%
6164
2 Bartvds 0.2%
6265
2 Edwin Shao 0.2%
6366
2 Gregg Lind 0.2%
64-
2 Roman Masek 0.2%
65-
2 Jérémie Astori 0.2%
6667
2 Jakub Nešetřil 0.2%
67-
2 eldritch fossicker 0.2%
68-
1 Adam Hull 0.1%
69-
1 toastynerd 0.1%
70-
1 Anand Patil 0.1%
71-
1 Benjamin Horsleben 0.1%
72-
1 Brandon Payton 0.1%
73-
1 Chasen Le Hara 0.1%
74-
1 Chris Connelly 0.1%
75-
1 Chris Thompson 0.1%
76-
1 Christopher Hiller 0.1%
77-
1 Chun-Yi 0.1%
78-
1 DD 0.1%
79-
1 Danilo Vaz 0.1%
80-
1 Dido Arellano 0.1%
81-
1 Doug Neiner 0.1%
82-
1 Jeff Welch 0.1%
68+
2 Roman Masek 0.2%
69+
2 Teddy Cross 0.2%
8370
1 Jesse McCarthy 0.1%
84-
1 Julien Wajsberg 0.1%
71+
1 Doug Neiner 0.1%
72+
1 Dido Arellano 0.1%
8573
1 Kilian Ciuffolo 0.1%
8674
1 Luís Cardoso 0.1%
8775
1 Martin Middel 0.1%
8876
1 Mathias Schreck 0.1%
77+
1 Danilo Vaz 0.1%
8978
1 Michael Lange 0.1%
79+
1 Mitchell Johnson 0.1%
80+
1 DD 0.1%
9081
1 Niklas Närhinen 0.1%
9182
1 Paul Miller 0.1%
9283
1 Refael Ackermann 0.1%
84+
1 shinnn 0.1%
85+
1 Chun-Yi 0.1%
86+
1 Christopher Hiller 0.1%
9387
1 Sasha Koss 0.1%
88+
1 Chris Thompson 0.1%
89+
1 toastynerd 0.1%
90+
1 Chris Connelly 0.1%
91+
1 Chasen Le Hara 0.1%
9492
1 Victor Costan 0.1%
9593
1 Vinay Pulim 0.1%
9694
1 Virginie BARDALES 0.1%
9795
1 Vlad GURDIGA 0.1%
96+
1 Brandon Payton 0.1%
97+
1 Adam Hull 0.1%
9898
1 ericdouglas 0.1%
99+
1 Benjamin Horsleben 0.1%
99100
1 laconbass 0.1%
101+
1 Anand Patil 0.1%
100102
1 mohayonao 0.1%
101103
1 piecioshka 0.1%
102104
1 root 0.1%
103-
1 shinnn 0.1%
105+
1 Julien Wajsberg 0.1%
106+
1 Jeff Welch 0.1%
104107

105108
## License
106109

ReleaseNotes.md

+31
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# Release Notes
22

3+
## 2.3.0 / 2015-04-26
4+
5+
Added `ownPropertyDescriptor` assertion:
6+
7+
```js
8+
expect('test').to.have.ownPropertyDescriptor('length');
9+
expect('test').to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 });
10+
expect('test').not.to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 });
11+
expect('test').ownPropertyDescriptor('length').to.have.property('enumerable', false);
12+
expect('test').ownPropertyDescriptor('length').to.have.keys('value');
13+
```
14+
15+
### Community Contributions
16+
17+
#### Code Features & Fixes
18+
19+
* [#408](https://github.com/chaijs/chai/pull/408) Add `ownPropertyDescriptor`
20+
assertion.
21+
By [@ljharb](https://github.com/ljharb)
22+
* [#422](https://github.com/chaijs/chai/pull/422) Improve ownPropertyDescriptor
23+
tests.
24+
By [@ljharb](https://github.com/ljharb)
25+
26+
#### Documentation fixes
27+
28+
* [#417](https://github.com/chaijs/chai/pull/417) Fix documentation typo
29+
By [@astorije](https://github.com/astorije)
30+
* [#423](https://github.com/chaijs/chai/pull/423) Fix inconsistency in docs.
31+
By [@ehntoo](https://github.com/ehntoo)
32+
33+
334
## 2.2.0 / 2015-03-26
435

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

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chai",
3-
"version": "2.2.0",
3+
"version": "2.3.0",
44
"description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic.",
55
"license": "MIT",
66
"keywords": [

chai.js

+64-15
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ var used = []
678678
* Chai version
679679
*/
680680

681-
exports.version = '2.2.0';
681+
exports.version = '2.3.0';
682682

683683
/*!
684684
* Assertion Error
@@ -1051,7 +1051,7 @@ module.exports = function (chai, _) {
10511051
* ### .any
10521052
*
10531053
* Sets the `any` flag, (opposite of the `all` flag)
1054-
* later used in the `keys` assertion.
1054+
* later used in the `keys` assertion.
10551055
*
10561056
* expect(foo).to.have.any.keys('bar', 'baz');
10571057
*
@@ -1068,7 +1068,7 @@ module.exports = function (chai, _) {
10681068
/**
10691069
* ### .all
10701070
*
1071-
* Sets the `all` flag (opposite of the `any` flag)
1071+
* Sets the `all` flag (opposite of the `any` flag)
10721072
* later used by the `keys` assertion.
10731073
*
10741074
* expect(foo).to.have.all.keys('bar', 'baz');
@@ -1249,7 +1249,7 @@ module.exports = function (chai, _) {
12491249
* Asserts that the target is `null`.
12501250
*
12511251
* expect(null).to.be.null;
1252-
* expect(undefined).not.to.be.null;
1252+
* expect(undefined).to.not.be.null;
12531253
*
12541254
* @name null
12551255
* @api public
@@ -1725,7 +1725,7 @@ module.exports = function (chai, _) {
17251725
* green: { tea: 'matcha' }
17261726
* , teas: [ 'chai', 'matcha', { tea: 'konacha' } ]
17271727
* };
1728-
*
1728+
*
17291729
* expect(deepObj).to.have.deep.property('green.tea', 'matcha');
17301730
* expect(deepObj).to.have.deep.property('teas[1]', 'matcha');
17311731
* expect(deepObj).to.have.deep.property('teas[2].tea', 'konacha');
@@ -1846,6 +1846,55 @@ module.exports = function (chai, _) {
18461846
Assertion.addMethod('ownProperty', assertOwnProperty);
18471847
Assertion.addMethod('haveOwnProperty', assertOwnProperty);
18481848

1849+
/**
1850+
* ### .ownPropertyDescriptor(name[, descriptor[, message]])
1851+
*
1852+
* Asserts that the target has an own property descriptor `name`, that optionally matches `descriptor`.
1853+
*
1854+
* expect('test').to.have.ownPropertyDescriptor('length');
1855+
* expect('test').to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 });
1856+
* expect('test').not.to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 });
1857+
* expect('test').ownPropertyDescriptor('length').to.have.property('enumerable', false);
1858+
* expect('test').ownPropertyDescriptor('length').to.have.keys('value');
1859+
*
1860+
* @name ownPropertyDescriptor
1861+
* @alias haveOwnPropertyDescriptor
1862+
* @param {String} name
1863+
* @param {Object} descriptor _optional_
1864+
* @param {String} message _optional_
1865+
* @api public
1866+
*/
1867+
1868+
function assertOwnPropertyDescriptor (name, descriptor, msg) {
1869+
if (typeof descriptor === 'string') {
1870+
msg = descriptor;
1871+
descriptor = null;
1872+
}
1873+
if (msg) flag(this, 'message', msg);
1874+
var obj = flag(this, 'object');
1875+
var actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name);
1876+
if (actualDescriptor && descriptor) {
1877+
this.assert(
1878+
_.eql(descriptor, actualDescriptor)
1879+
, 'expected the own property descriptor for ' + _.inspect(name) + ' on #{this} to match ' + _.inspect(descriptor) + ', got ' + _.inspect(actualDescriptor)
1880+
, 'expected the own property descriptor for ' + _.inspect(name) + ' on #{this} to not match ' + _.inspect(descriptor)
1881+
, descriptor
1882+
, actualDescriptor
1883+
, true
1884+
);
1885+
} else {
1886+
this.assert(
1887+
actualDescriptor
1888+
, 'expected #{this} to have an own property descriptor for ' + _.inspect(name)
1889+
, 'expected #{this} to not have an own property descriptor for ' + _.inspect(name)
1890+
);
1891+
}
1892+
flag(this, 'object', actualDescriptor);
1893+
}
1894+
1895+
Assertion.addMethod('ownPropertyDescriptor', assertOwnPropertyDescriptor);
1896+
Assertion.addMethod('haveOwnPropertyDescriptor', assertOwnPropertyDescriptor);
1897+
18491898
/**
18501899
* ### .length(value)
18511900
*
@@ -1947,30 +1996,30 @@ module.exports = function (chai, _) {
19471996
* ### .keys(key1, [key2], [...])
19481997
*
19491998
* Asserts that the target contains any or all of the passed-in keys.
1950-
* Use in combination with `any`, `all`, `contains`, or `have` will affect
1999+
* Use in combination with `any`, `all`, `contains`, or `have` will affect
19512000
* what will pass.
1952-
*
1953-
* When used in conjunction with `any`, at least one key that is passed
1954-
* in must exist in the target object. This is regardless whether or not
2001+
*
2002+
* When used in conjunction with `any`, at least one key that is passed
2003+
* in must exist in the target object. This is regardless whether or not
19552004
* the `have` or `contain` qualifiers are used. Note, either `any` or `all`
19562005
* should be used in the assertion. If neither are used, the assertion is
19572006
* defaulted to `all`.
1958-
*
1959-
* When both `all` and `contain` are used, the target object must have at
2007+
*
2008+
* When both `all` and `contain` are used, the target object must have at
19602009
* least all of the passed-in keys but may have more keys not listed.
1961-
*
2010+
*
19622011
* When both `all` and `have` are used, the target object must both contain
19632012
* all of the passed-in keys AND the number of keys in the target object must
1964-
* match the number of keys passed in (in other words, a target object must
2013+
* match the number of keys passed in (in other words, a target object must
19652014
* have all and only all of the passed-in keys).
1966-
*
2015+
*
19672016
* expect({ foo: 1, bar: 2 }).to.have.any.keys('foo', 'baz');
19682017
* expect({ foo: 1, bar: 2 }).to.have.any.keys('foo');
19692018
* expect({ foo: 1, bar: 2 }).to.contain.any.keys('bar', 'baz');
19702019
* expect({ foo: 1, bar: 2 }).to.contain.any.keys(['foo']);
19712020
* expect({ foo: 1, bar: 2 }).to.contain.any.keys({'foo': 6});
19722021
* expect({ foo: 1, bar: 2 }).to.have.all.keys(['bar', 'foo']);
1973-
* expect({ foo: 1, bar: 2 }).to.have.all.keys({'bar': 6, 'foo', 7});
2022+
* expect({ foo: 1, bar: 2 }).to.have.all.keys({'bar': 6, 'foo': 7});
19742023
* expect({ foo: 1, bar: 2, baz: 3 }).to.contain.all.keys(['bar', 'foo']);
19752024
* expect({ foo: 1, bar: 2, baz: 3 }).to.contain.all.keys([{'bar': 6}}]);
19762025
*

component.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "chai"
33
, "repo": "chaijs/chai"
4-
, "version": "2.2.0"
4+
, "version": "2.3.0"
55
, "description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic."
66
, "license": "MIT"
77
, "keywords": [

lib/chai.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var used = []
1111
* Chai version
1212
*/
1313

14-
exports.version = '2.2.0';
14+
exports.version = '2.3.0';
1515

1616
/*!
1717
* Assertion Error

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"Veselin Todorov <[email protected]>",
1818
"John Firebaugh <[email protected]>"
1919
],
20-
"version": "2.2.0",
20+
"version": "2.3.0",
2121
"repository": {
2222
"type": "git",
2323
"url": "https://github.com/chaijs/chai"

0 commit comments

Comments
 (0)