@@ -15,7 +15,7 @@ var used = []
1515 * Chai version
1616 */
1717
18- exports . version = '3.1 .0' ;
18+ exports . version = '3.2 .0' ;
1919
2020/*!
2121 * Assertion Error
@@ -1657,12 +1657,13 @@ module.exports = function (chai, _) {
16571657 * expect(Klass).itself.to.respondTo('baz');
16581658 *
16591659 * @name respondTo
1660+ * @alias respondsTo
16601661 * @param {String } method
16611662 * @param {String } message _optional_
16621663 * @api public
16631664 */
16641665
1665- Assertion . addMethod ( 'respondTo' , function ( method , msg ) {
1666+ function respondTo ( method , msg ) {
16661667 if ( msg ) flag ( this , 'message' , msg ) ;
16671668 var obj = flag ( this , 'object' )
16681669 , itself = flag ( this , 'itself' )
@@ -1675,7 +1676,10 @@ module.exports = function (chai, _) {
16751676 , 'expected #{this} to respond to ' + _ . inspect ( method )
16761677 , 'expected #{this} to not respond to ' + _ . inspect ( method )
16771678 ) ;
1678- } ) ;
1679+ }
1680+
1681+ Assertion . addMethod ( 'respondTo' , respondTo ) ;
1682+ Assertion . addMethod ( 'respondsTo' , respondTo ) ;
16791683
16801684 /**
16811685 * ### .itself
@@ -1705,12 +1709,13 @@ module.exports = function (chai, _) {
17051709 * expect(1).to.satisfy(function(num) { return num > 0; });
17061710 *
17071711 * @name satisfy
1712+ * @alias satisfies
17081713 * @param {Function } matcher
17091714 * @param {String } message _optional_
17101715 * @api public
17111716 */
17121717
1713- Assertion . addMethod ( 'satisfy' , function ( matcher , msg ) {
1718+ function satisfy ( matcher , msg ) {
17141719 if ( msg ) flag ( this , 'message' , msg ) ;
17151720 var obj = flag ( this , 'object' ) ;
17161721 var result = matcher ( obj ) ;
@@ -1721,7 +1726,10 @@ module.exports = function (chai, _) {
17211726 , this . negate ? false : true
17221727 , result
17231728 ) ;
1724- } ) ;
1729+ }
1730+
1731+ Assertion . addMethod ( 'satisfy' , satisfy ) ;
1732+ Assertion . addMethod ( 'satisfies' , satisfy ) ;
17251733
17261734 /**
17271735 * ### .closeTo(expected, delta)
@@ -2001,7 +2009,7 @@ module.exports = function (chai, _) {
20012009 var obj = flag ( this , 'object' ) ;
20022010
20032011 this . assert (
2004- Object . isSealed ( obj )
2012+ Object . isFrozen ( obj )
20052013 , 'expected #{this} to be frozen'
20062014 , 'expected #{this} to not be frozen'
20072015 ) ;
@@ -2076,38 +2084,40 @@ module.exports = function (chai, util) {
20762084 } ;
20772085
20782086 /**
2079- * ### .ok (object, [message])
2087+ * ### .isOk (object, [message])
20802088 *
20812089 * Asserts that `object` is truthy.
20822090 *
2083- * assert.ok ('everything', 'everything is ok');
2084- * assert.ok (false, 'this will fail');
2091+ * assert.isOk ('everything', 'everything is ok');
2092+ * assert.isOk (false, 'this will fail');
20852093 *
2086- * @name ok
2094+ * @name isOk
2095+ * @alias ok
20872096 * @param {Mixed } object to test
20882097 * @param {String } message
20892098 * @api public
20902099 */
20912100
2092- assert . ok = function ( val , msg ) {
2101+ assert . isOk = function ( val , msg ) {
20932102 new Assertion ( val , msg ) . is . ok ;
20942103 } ;
20952104
20962105 /**
2097- * ### .notOk (object, [message])
2106+ * ### .isNotOk (object, [message])
20982107 *
20992108 * Asserts that `object` is falsy.
21002109 *
2101- * assert.notOk ('everything', 'this will fail');
2102- * assert.notOk (false, 'this will pass');
2110+ * assert.isNotOk ('everything', 'this will fail');
2111+ * assert.isNotOk (false, 'this will pass');
21032112 *
2104- * @name notOk
2113+ * @name isNotOk
2114+ * @alias notOk
21052115 * @param {Mixed } object to test
21062116 * @param {String } message
21072117 * @api public
21082118 */
21092119
2110- assert . notOk = function ( val , msg ) {
2120+ assert . isNotOk = function ( val , msg ) {
21112121 new Assertion ( val , msg ) . is . not . ok ;
21122122 } ;
21132123
@@ -2976,11 +2986,11 @@ module.exports = function (chai, util) {
29762986 * `constructor`, or alternately that it will throw an error with message
29772987 * matching `regexp`.
29782988 *
2979- * assert.throw (fn, 'function throws a reference error');
2980- * assert.throw (fn, /function throws a reference error/);
2981- * assert.throw (fn, ReferenceError);
2982- * assert.throw (fn, ReferenceError, 'function throws a reference error');
2983- * assert.throw (fn, ReferenceError, /function throws a reference error/);
2989+ * assert.throws (fn, 'function throws a reference error');
2990+ * assert.throws (fn, /function throws a reference error/);
2991+ * assert.throws (fn, ReferenceError);
2992+ * assert.throws (fn, ReferenceError, 'function throws a reference error');
2993+ * assert.throws (fn, ReferenceError, /function throws a reference error/);
29842994 *
29852995 * @name throws
29862996 * @alias throw
@@ -2993,13 +3003,13 @@ module.exports = function (chai, util) {
29933003 * @api public
29943004 */
29953005
2996- assert . Throw = function ( fn , errt , errs , msg ) {
3006+ assert . throws = function ( fn , errt , errs , msg ) {
29973007 if ( 'string' === typeof errt || errt instanceof RegExp ) {
29983008 errs = errt ;
29993009 errt = null ;
30003010 }
30013011
3002- var assertErr = new Assertion ( fn , msg ) . to . Throw ( errt , errs ) ;
3012+ var assertErr = new Assertion ( fn , msg ) . to . throw ( errt , errs ) ;
30033013 return flag ( assertErr , 'object' ) ;
30043014 } ;
30053015
@@ -3289,7 +3299,7 @@ module.exports = function (chai, util) {
32893299 * ### .ifError(object)
32903300 *
32913301 * Asserts if value is not a false value, and throws if it is a true value.
3292- * This is added to allow for chai to be a drop-in replacement for Node's
3302+ * This is added to allow for chai to be a drop-in replacement for Node's
32933303 * assert class.
32943304 *
32953305 * var err = new Error('I am a custom error');
@@ -3307,117 +3317,123 @@ module.exports = function (chai, util) {
33073317 } ;
33083318
33093319 /**
3310- * ### .extensible (object)
3320+ * ### .isExtensible (object)
33113321 *
33123322 * Asserts that `object` is extensible (can have new properties added to it).
33133323 *
3314- * assert.extensible ({});
3324+ * assert.isExtensible ({});
33153325 *
3316- * @name extensible
3326+ * @name isExtensible
3327+ * @alias extensible
33173328 * @param {Object } object
33183329 * @param {String } message _optional_
33193330 * @api public
33203331 */
33213332
3322- assert . extensible = function ( obj , msg ) {
3333+ assert . isExtensible = function ( obj , msg ) {
33233334 new Assertion ( obj , msg ) . to . be . extensible ;
33243335 } ;
33253336
33263337 /**
3327- * ### .notExtensible (object)
3338+ * ### .isNotExtensible (object)
33283339 *
33293340 * Asserts that `object` is _not_ extensible.
33303341 *
33313342 * var nonExtensibleObject = Object.preventExtensions({});
33323343 * var sealedObject = Object.seal({});
33333344 * var frozenObject = Object.freese({});
33343345 *
3335- * assert.notExtensible (nonExtensibleObject);
3336- * assert.notExtensible (sealedObject);
3337- * assert.notExtensible (frozenObject);
3346+ * assert.isNotExtensible (nonExtensibleObject);
3347+ * assert.isNotExtensible (sealedObject);
3348+ * assert.isNotExtensible (frozenObject);
33383349 *
3339- * @name notExtensible
3350+ * @name isNotExtensible
3351+ * @alias notExtensible
33403352 * @param {Object } object
33413353 * @param {String } message _optional_
33423354 * @api public
33433355 */
33443356
3345- assert . notExtensible = function ( obj , msg ) {
3357+ assert . isNotExtensible = function ( obj , msg ) {
33463358 new Assertion ( obj , msg ) . to . not . be . extensible ;
33473359 } ;
33483360
33493361 /**
3350- * ### .sealed (object)
3362+ * ### .isSealed (object)
33513363 *
33523364 * Asserts that `object` is sealed (cannot have new properties added to it
33533365 * and its existing properties cannot be removed).
33543366 *
33553367 * var sealedObject = Object.seal({});
33563368 * var frozenObject = Object.seal({});
33573369 *
3358- * assert.sealed (sealedObject);
3359- * assert.sealed (frozenObject);
3370+ * assert.isSealed (sealedObject);
3371+ * assert.isSealed (frozenObject);
33603372 *
3361- * @name sealed
3373+ * @name isSealed
3374+ * @alias sealed
33623375 * @param {Object } object
33633376 * @param {String } message _optional_
33643377 * @api public
33653378 */
33663379
3367- assert . sealed = function ( obj , msg ) {
3380+ assert . isSealed = function ( obj , msg ) {
33683381 new Assertion ( obj , msg ) . to . be . sealed ;
33693382 } ;
33703383
33713384 /**
3372- * ### .notSealed (object)
3385+ * ### .isNotSealed (object)
33733386 *
33743387 * Asserts that `object` is _not_ sealed.
33753388 *
3376- * assert.notSealed ({});
3389+ * assert.isNotSealed ({});
33773390 *
3378- * @name notSealed
3391+ * @name isNotSealed
3392+ * @alias notSealed
33793393 * @param {Object } object
33803394 * @param {String } message _optional_
33813395 * @api public
33823396 */
33833397
3384- assert . notSealed = function ( obj , msg ) {
3398+ assert . isNotSealed = function ( obj , msg ) {
33853399 new Assertion ( obj , msg ) . to . not . be . sealed ;
33863400 } ;
33873401
33883402 /**
3389- * ### .frozen (object)
3403+ * ### .isFrozen (object)
33903404 *
33913405 * Asserts that `object` is frozen (cannot have new properties added to it
33923406 * and its existing properties cannot be modified).
33933407 *
33943408 * var frozenObject = Object.freeze({});
33953409 * assert.frozen(frozenObject);
33963410 *
3397- * @name frozen
3411+ * @name isFrozen
3412+ * @alias frozen
33983413 * @param {Object } object
33993414 * @param {String } message _optional_
34003415 * @api public
34013416 */
34023417
3403- assert . frozen = function ( obj , msg ) {
3418+ assert . isFrozen = function ( obj , msg ) {
34043419 new Assertion ( obj , msg ) . to . be . frozen ;
34053420 } ;
34063421
34073422 /**
3408- * ### .notFrozen (object)
3423+ * ### .isNotFrozen (object)
34093424 *
34103425 * Asserts that `object` is _not_ frozen.
34113426 *
3412- * assert.notFrozen ({});
3427+ * assert.isNotFrozen ({});
34133428 *
3414- * @name notSealed
3429+ * @name isNotFrozen
3430+ * @alias notFrozen
34153431 * @param {Object } object
34163432 * @param {String } message _optional_
34173433 * @api public
34183434 */
34193435
3420- assert . notFrozen = function ( obj , msg ) {
3436+ assert . isNotFrozen = function ( obj , msg ) {
34213437 new Assertion ( obj , msg ) . to . not . be . frozen ;
34223438 } ;
34233439
@@ -3429,8 +3445,16 @@ module.exports = function (chai, util) {
34293445 assert [ as ] = assert [ name ] ;
34303446 return alias ;
34313447 } )
3432- ( 'Throw' , 'throw' )
3433- ( 'Throw' , 'throws' ) ;
3448+ ( 'isOk' , 'ok' )
3449+ ( 'isNotOk' , 'notOk' )
3450+ ( 'throws' , 'throw' )
3451+ ( 'throws' , 'Throw' )
3452+ ( 'isExtensible' , 'extensible' )
3453+ ( 'isNotExtensible' , 'notExtensible' )
3454+ ( 'isSealed' , 'sealed' )
3455+ ( 'isNotSealed' , 'notSealed' )
3456+ ( 'isFrozen' , 'frozen' )
3457+ ( 'isNotFrozen' , 'notFrozen' ) ;
34343458} ;
34353459
34363460} , { } ] , 7 :[ function ( require , module , exports ) {
@@ -4099,15 +4123,15 @@ module.exports = function(path, obj) {
40994123 */
41004124
41014125module . exports = function getProperties ( object ) {
4102- var result = Object . getOwnPropertyNames ( subject ) ;
4126+ var result = Object . getOwnPropertyNames ( object ) ;
41034127
41044128 function addProperty ( property ) {
41054129 if ( result . indexOf ( property ) === - 1 ) {
41064130 result . push ( property ) ;
41074131 }
41084132 }
41094133
4110- var proto = Object . getPrototypeOf ( subject ) ;
4134+ var proto = Object . getPrototypeOf ( object ) ;
41114135 while ( proto !== null ) {
41124136 Object . getOwnPropertyNames ( proto ) . forEach ( addProperty ) ;
41134137 proto = Object . getPrototypeOf ( proto ) ;
0 commit comments