@@ -15,7 +15,7 @@ var used = []
15
15
* Chai version
16
16
*/
17
17
18
- exports . version = '3.1 .0' ;
18
+ exports . version = '3.2 .0' ;
19
19
20
20
/*!
21
21
* Assertion Error
@@ -1657,12 +1657,13 @@ module.exports = function (chai, _) {
1657
1657
* expect(Klass).itself.to.respondTo('baz');
1658
1658
*
1659
1659
* @name respondTo
1660
+ * @alias respondsTo
1660
1661
* @param {String } method
1661
1662
* @param {String } message _optional_
1662
1663
* @api public
1663
1664
*/
1664
1665
1665
- Assertion . addMethod ( 'respondTo' , function ( method , msg ) {
1666
+ function respondTo ( method , msg ) {
1666
1667
if ( msg ) flag ( this , 'message' , msg ) ;
1667
1668
var obj = flag ( this , 'object' )
1668
1669
, itself = flag ( this , 'itself' )
@@ -1675,7 +1676,10 @@ module.exports = function (chai, _) {
1675
1676
, 'expected #{this} to respond to ' + _ . inspect ( method )
1676
1677
, 'expected #{this} to not respond to ' + _ . inspect ( method )
1677
1678
) ;
1678
- } ) ;
1679
+ }
1680
+
1681
+ Assertion . addMethod ( 'respondTo' , respondTo ) ;
1682
+ Assertion . addMethod ( 'respondsTo' , respondTo ) ;
1679
1683
1680
1684
/**
1681
1685
* ### .itself
@@ -1705,12 +1709,13 @@ module.exports = function (chai, _) {
1705
1709
* expect(1).to.satisfy(function(num) { return num > 0; });
1706
1710
*
1707
1711
* @name satisfy
1712
+ * @alias satisfies
1708
1713
* @param {Function } matcher
1709
1714
* @param {String } message _optional_
1710
1715
* @api public
1711
1716
*/
1712
1717
1713
- Assertion . addMethod ( 'satisfy' , function ( matcher , msg ) {
1718
+ function satisfy ( matcher , msg ) {
1714
1719
if ( msg ) flag ( this , 'message' , msg ) ;
1715
1720
var obj = flag ( this , 'object' ) ;
1716
1721
var result = matcher ( obj ) ;
@@ -1721,7 +1726,10 @@ module.exports = function (chai, _) {
1721
1726
, this . negate ? false : true
1722
1727
, result
1723
1728
) ;
1724
- } ) ;
1729
+ }
1730
+
1731
+ Assertion . addMethod ( 'satisfy' , satisfy ) ;
1732
+ Assertion . addMethod ( 'satisfies' , satisfy ) ;
1725
1733
1726
1734
/**
1727
1735
* ### .closeTo(expected, delta)
@@ -2001,7 +2009,7 @@ module.exports = function (chai, _) {
2001
2009
var obj = flag ( this , 'object' ) ;
2002
2010
2003
2011
this . assert (
2004
- Object . isSealed ( obj )
2012
+ Object . isFrozen ( obj )
2005
2013
, 'expected #{this} to be frozen'
2006
2014
, 'expected #{this} to not be frozen'
2007
2015
) ;
@@ -2076,38 +2084,40 @@ module.exports = function (chai, util) {
2076
2084
} ;
2077
2085
2078
2086
/**
2079
- * ### .ok (object, [message])
2087
+ * ### .isOk (object, [message])
2080
2088
*
2081
2089
* Asserts that `object` is truthy.
2082
2090
*
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');
2085
2093
*
2086
- * @name ok
2094
+ * @name isOk
2095
+ * @alias ok
2087
2096
* @param {Mixed } object to test
2088
2097
* @param {String } message
2089
2098
* @api public
2090
2099
*/
2091
2100
2092
- assert . ok = function ( val , msg ) {
2101
+ assert . isOk = function ( val , msg ) {
2093
2102
new Assertion ( val , msg ) . is . ok ;
2094
2103
} ;
2095
2104
2096
2105
/**
2097
- * ### .notOk (object, [message])
2106
+ * ### .isNotOk (object, [message])
2098
2107
*
2099
2108
* Asserts that `object` is falsy.
2100
2109
*
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');
2103
2112
*
2104
- * @name notOk
2113
+ * @name isNotOk
2114
+ * @alias notOk
2105
2115
* @param {Mixed } object to test
2106
2116
* @param {String } message
2107
2117
* @api public
2108
2118
*/
2109
2119
2110
- assert . notOk = function ( val , msg ) {
2120
+ assert . isNotOk = function ( val , msg ) {
2111
2121
new Assertion ( val , msg ) . is . not . ok ;
2112
2122
} ;
2113
2123
@@ -2976,11 +2986,11 @@ module.exports = function (chai, util) {
2976
2986
* `constructor`, or alternately that it will throw an error with message
2977
2987
* matching `regexp`.
2978
2988
*
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/);
2984
2994
*
2985
2995
* @name throws
2986
2996
* @alias throw
@@ -2993,13 +3003,13 @@ module.exports = function (chai, util) {
2993
3003
* @api public
2994
3004
*/
2995
3005
2996
- assert . Throw = function ( fn , errt , errs , msg ) {
3006
+ assert . throws = function ( fn , errt , errs , msg ) {
2997
3007
if ( 'string' === typeof errt || errt instanceof RegExp ) {
2998
3008
errs = errt ;
2999
3009
errt = null ;
3000
3010
}
3001
3011
3002
- var assertErr = new Assertion ( fn , msg ) . to . Throw ( errt , errs ) ;
3012
+ var assertErr = new Assertion ( fn , msg ) . to . throw ( errt , errs ) ;
3003
3013
return flag ( assertErr , 'object' ) ;
3004
3014
} ;
3005
3015
@@ -3289,7 +3299,7 @@ module.exports = function (chai, util) {
3289
3299
* ### .ifError(object)
3290
3300
*
3291
3301
* 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
3293
3303
* assert class.
3294
3304
*
3295
3305
* var err = new Error('I am a custom error');
@@ -3307,117 +3317,123 @@ module.exports = function (chai, util) {
3307
3317
} ;
3308
3318
3309
3319
/**
3310
- * ### .extensible (object)
3320
+ * ### .isExtensible (object)
3311
3321
*
3312
3322
* Asserts that `object` is extensible (can have new properties added to it).
3313
3323
*
3314
- * assert.extensible ({});
3324
+ * assert.isExtensible ({});
3315
3325
*
3316
- * @name extensible
3326
+ * @name isExtensible
3327
+ * @alias extensible
3317
3328
* @param {Object } object
3318
3329
* @param {String } message _optional_
3319
3330
* @api public
3320
3331
*/
3321
3332
3322
- assert . extensible = function ( obj , msg ) {
3333
+ assert . isExtensible = function ( obj , msg ) {
3323
3334
new Assertion ( obj , msg ) . to . be . extensible ;
3324
3335
} ;
3325
3336
3326
3337
/**
3327
- * ### .notExtensible (object)
3338
+ * ### .isNotExtensible (object)
3328
3339
*
3329
3340
* Asserts that `object` is _not_ extensible.
3330
3341
*
3331
3342
* var nonExtensibleObject = Object.preventExtensions({});
3332
3343
* var sealedObject = Object.seal({});
3333
3344
* var frozenObject = Object.freese({});
3334
3345
*
3335
- * assert.notExtensible (nonExtensibleObject);
3336
- * assert.notExtensible (sealedObject);
3337
- * assert.notExtensible (frozenObject);
3346
+ * assert.isNotExtensible (nonExtensibleObject);
3347
+ * assert.isNotExtensible (sealedObject);
3348
+ * assert.isNotExtensible (frozenObject);
3338
3349
*
3339
- * @name notExtensible
3350
+ * @name isNotExtensible
3351
+ * @alias notExtensible
3340
3352
* @param {Object } object
3341
3353
* @param {String } message _optional_
3342
3354
* @api public
3343
3355
*/
3344
3356
3345
- assert . notExtensible = function ( obj , msg ) {
3357
+ assert . isNotExtensible = function ( obj , msg ) {
3346
3358
new Assertion ( obj , msg ) . to . not . be . extensible ;
3347
3359
} ;
3348
3360
3349
3361
/**
3350
- * ### .sealed (object)
3362
+ * ### .isSealed (object)
3351
3363
*
3352
3364
* Asserts that `object` is sealed (cannot have new properties added to it
3353
3365
* and its existing properties cannot be removed).
3354
3366
*
3355
3367
* var sealedObject = Object.seal({});
3356
3368
* var frozenObject = Object.seal({});
3357
3369
*
3358
- * assert.sealed (sealedObject);
3359
- * assert.sealed (frozenObject);
3370
+ * assert.isSealed (sealedObject);
3371
+ * assert.isSealed (frozenObject);
3360
3372
*
3361
- * @name sealed
3373
+ * @name isSealed
3374
+ * @alias sealed
3362
3375
* @param {Object } object
3363
3376
* @param {String } message _optional_
3364
3377
* @api public
3365
3378
*/
3366
3379
3367
- assert . sealed = function ( obj , msg ) {
3380
+ assert . isSealed = function ( obj , msg ) {
3368
3381
new Assertion ( obj , msg ) . to . be . sealed ;
3369
3382
} ;
3370
3383
3371
3384
/**
3372
- * ### .notSealed (object)
3385
+ * ### .isNotSealed (object)
3373
3386
*
3374
3387
* Asserts that `object` is _not_ sealed.
3375
3388
*
3376
- * assert.notSealed ({});
3389
+ * assert.isNotSealed ({});
3377
3390
*
3378
- * @name notSealed
3391
+ * @name isNotSealed
3392
+ * @alias notSealed
3379
3393
* @param {Object } object
3380
3394
* @param {String } message _optional_
3381
3395
* @api public
3382
3396
*/
3383
3397
3384
- assert . notSealed = function ( obj , msg ) {
3398
+ assert . isNotSealed = function ( obj , msg ) {
3385
3399
new Assertion ( obj , msg ) . to . not . be . sealed ;
3386
3400
} ;
3387
3401
3388
3402
/**
3389
- * ### .frozen (object)
3403
+ * ### .isFrozen (object)
3390
3404
*
3391
3405
* Asserts that `object` is frozen (cannot have new properties added to it
3392
3406
* and its existing properties cannot be modified).
3393
3407
*
3394
3408
* var frozenObject = Object.freeze({});
3395
3409
* assert.frozen(frozenObject);
3396
3410
*
3397
- * @name frozen
3411
+ * @name isFrozen
3412
+ * @alias frozen
3398
3413
* @param {Object } object
3399
3414
* @param {String } message _optional_
3400
3415
* @api public
3401
3416
*/
3402
3417
3403
- assert . frozen = function ( obj , msg ) {
3418
+ assert . isFrozen = function ( obj , msg ) {
3404
3419
new Assertion ( obj , msg ) . to . be . frozen ;
3405
3420
} ;
3406
3421
3407
3422
/**
3408
- * ### .notFrozen (object)
3423
+ * ### .isNotFrozen (object)
3409
3424
*
3410
3425
* Asserts that `object` is _not_ frozen.
3411
3426
*
3412
- * assert.notFrozen ({});
3427
+ * assert.isNotFrozen ({});
3413
3428
*
3414
- * @name notSealed
3429
+ * @name isNotFrozen
3430
+ * @alias notFrozen
3415
3431
* @param {Object } object
3416
3432
* @param {String } message _optional_
3417
3433
* @api public
3418
3434
*/
3419
3435
3420
- assert . notFrozen = function ( obj , msg ) {
3436
+ assert . isNotFrozen = function ( obj , msg ) {
3421
3437
new Assertion ( obj , msg ) . to . not . be . frozen ;
3422
3438
} ;
3423
3439
@@ -3429,8 +3445,16 @@ module.exports = function (chai, util) {
3429
3445
assert [ as ] = assert [ name ] ;
3430
3446
return alias ;
3431
3447
} )
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' ) ;
3434
3458
} ;
3435
3459
3436
3460
} , { } ] , 7 :[ function ( require , module , exports ) {
@@ -4099,15 +4123,15 @@ module.exports = function(path, obj) {
4099
4123
*/
4100
4124
4101
4125
module . exports = function getProperties ( object ) {
4102
- var result = Object . getOwnPropertyNames ( subject ) ;
4126
+ var result = Object . getOwnPropertyNames ( object ) ;
4103
4127
4104
4128
function addProperty ( property ) {
4105
4129
if ( result . indexOf ( property ) === - 1 ) {
4106
4130
result . push ( property ) ;
4107
4131
}
4108
4132
}
4109
4133
4110
- var proto = Object . getPrototypeOf ( subject ) ;
4134
+ var proto = Object . getPrototypeOf ( object ) ;
4111
4135
while ( proto !== null ) {
4112
4136
Object . getOwnPropertyNames ( proto ) . forEach ( addProperty ) ;
4113
4137
proto = Object . getPrototypeOf ( proto ) ;
0 commit comments