@@ -15,7 +15,7 @@ var used = []
1515 * Chai version
1616 */
1717
18- exports . version = '3.4.2 ' ;
18+ exports . version = '3.5.0 ' ;
1919
2020/*!
2121 * Assertion Error
@@ -1914,7 +1914,7 @@ module.exports = function (chai, _) {
19141914 * var fn = function() { obj.val += 3 };
19151915 * var noChangeFn = function() { return 'foo' + 'bar'; }
19161916 * expect(fn).to.change(obj, 'val');
1917- * expect(noChangFn ).to.not.change(obj, 'val')
1917+ * expect(noChangeFn ).to.not.change(obj, 'val')
19181918 *
19191919 * @name change
19201920 * @alias changes
@@ -2689,8 +2689,8 @@ module.exports = function (chai, util) {
26892689 /**
26902690 * ### .isObject(value, [message])
26912691 *
2692- * Asserts that `value` is an object (as revealed by
2693- * `Object.prototype.toString`).
2692+ * Asserts that `value` is an object of type 'Object' (as revealed by `Object.prototype.toString`).
2693+ * _The assertion does not match subclassed objects._
26942694 *
26952695 * var selection = { name: 'Chai', serve: 'with spices' };
26962696 * assert.isObject(selection, 'tea selection is an object');
@@ -2709,7 +2709,7 @@ module.exports = function (chai, util) {
27092709 /**
27102710 * ### .isNotObject(value, [message])
27112711 *
2712- * Asserts that `value` is _not_ an object.
2712+ * Asserts that `value` is _not_ an object of type 'Object' (as revealed by `Object.prototype.toString`) .
27132713 *
27142714 * var selection = 'chai'
27152715 * assert.isNotObject(selection, 'tea selection is not an object');
@@ -3454,6 +3454,27 @@ module.exports = function (chai, util) {
34543454 new Assertion ( superset , msg ) . to . include . members ( subset ) ;
34553455 }
34563456
3457+ /**
3458+ * ### .includeDeepMembers(superset, subset, [message])
3459+ *
3460+ * Asserts that `subset` is included in `superset` - using deep equality checking.
3461+ * Order is not taken into account.
3462+ * Duplicates are ignored.
3463+ *
3464+ * assert.includeDeepMembers([ {a: 1}, {b: 2}, {c: 3} ], [ {b: 2}, {a: 1}, {b: 2} ], 'include deep members');
3465+ *
3466+ * @name includeDeepMembers
3467+ * @param {Array } superset
3468+ * @param {Array } subset
3469+ * @param {String } message
3470+ * @namespace Assert
3471+ * @api public
3472+ */
3473+
3474+ assert . includeDeepMembers = function ( superset , subset , msg ) {
3475+ new Assertion ( superset , msg ) . to . include . deep . members ( subset ) ;
3476+ }
3477+
34573478 /**
34583479 * ### .oneOf(inList, list, [message])
34593480 *
@@ -3874,29 +3895,131 @@ module.exports = function (chai, util) {
38743895 } , should . fail ) ;
38753896 } ;
38763897
3898+ /**
3899+ * ### .equal(actual, expected, [message])
3900+ *
3901+ * Asserts non-strict equality (`==`) of `actual` and `expected`.
3902+ *
3903+ * should.equal(3, '3', '== coerces values to strings');
3904+ *
3905+ * @name equal
3906+ * @param {Mixed } actual
3907+ * @param {Mixed } expected
3908+ * @param {String } message
3909+ * @namespace Should
3910+ * @api public
3911+ */
3912+
38773913 should . equal = function ( val1 , val2 , msg ) {
38783914 new Assertion ( val1 , msg ) . to . equal ( val2 ) ;
38793915 } ;
38803916
3917+ /**
3918+ * ### .throw(function, [constructor/string/regexp], [string/regexp], [message])
3919+ *
3920+ * Asserts that `function` will throw an error that is an instance of
3921+ * `constructor`, or alternately that it will throw an error with message
3922+ * matching `regexp`.
3923+ *
3924+ * should.throw(fn, 'function throws a reference error');
3925+ * should.throw(fn, /function throws a reference error/);
3926+ * should.throw(fn, ReferenceError);
3927+ * should.throw(fn, ReferenceError, 'function throws a reference error');
3928+ * should.throw(fn, ReferenceError, /function throws a reference error/);
3929+ *
3930+ * @name throw
3931+ * @alias Throw
3932+ * @param {Function } function
3933+ * @param {ErrorConstructor } constructor
3934+ * @param {RegExp } regexp
3935+ * @param {String } message
3936+ * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
3937+ * @namespace Should
3938+ * @api public
3939+ */
3940+
38813941 should . Throw = function ( fn , errt , errs , msg ) {
38823942 new Assertion ( fn , msg ) . to . Throw ( errt , errs ) ;
38833943 } ;
38843944
3945+ /**
3946+ * ### .exist
3947+ *
3948+ * Asserts that the target is neither `null` nor `undefined`.
3949+ *
3950+ * var foo = 'hi';
3951+ *
3952+ * should.exist(foo, 'foo exists');
3953+ *
3954+ * @name exist
3955+ * @namespace Should
3956+ * @api public
3957+ */
3958+
38853959 should . exist = function ( val , msg ) {
38863960 new Assertion ( val , msg ) . to . exist ;
38873961 }
38883962
38893963 // negation
38903964 should . not = { }
38913965
3966+ /**
3967+ * ### .not.equal(actual, expected, [message])
3968+ *
3969+ * Asserts non-strict inequality (`!=`) of `actual` and `expected`.
3970+ *
3971+ * should.not.equal(3, 4, 'these numbers are not equal');
3972+ *
3973+ * @name not.equal
3974+ * @param {Mixed } actual
3975+ * @param {Mixed } expected
3976+ * @param {String } message
3977+ * @namespace Should
3978+ * @api public
3979+ */
3980+
38923981 should . not . equal = function ( val1 , val2 , msg ) {
38933982 new Assertion ( val1 , msg ) . to . not . equal ( val2 ) ;
38943983 } ;
38953984
3985+ /**
3986+ * ### .throw(function, [constructor/regexp], [message])
3987+ *
3988+ * Asserts that `function` will _not_ throw an error that is an instance of
3989+ * `constructor`, or alternately that it will not throw an error with message
3990+ * matching `regexp`.
3991+ *
3992+ * should.not.throw(fn, Error, 'function does not throw');
3993+ *
3994+ * @name not.throw
3995+ * @alias not.Throw
3996+ * @param {Function } function
3997+ * @param {ErrorConstructor } constructor
3998+ * @param {RegExp } regexp
3999+ * @param {String } message
4000+ * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
4001+ * @namespace Should
4002+ * @api public
4003+ */
4004+
38964005 should . not . Throw = function ( fn , errt , errs , msg ) {
38974006 new Assertion ( fn , msg ) . to . not . Throw ( errt , errs ) ;
38984007 } ;
38994008
4009+ /**
4010+ * ### .not.exist
4011+ *
4012+ * Asserts that the target is neither `null` nor `undefined`.
4013+ *
4014+ * var bar = null;
4015+ *
4016+ * should.not.exist(bar, 'bar does not exist');
4017+ *
4018+ * @name not.exist
4019+ * @namespace Should
4020+ * @api public
4021+ */
4022+
39004023 should . not . exist = function ( val , msg ) {
39014024 new Assertion ( val , msg ) . to . not . exist ;
39024025 }
@@ -4296,9 +4419,9 @@ module.exports = function (obj, args) {
42964419 if ( typeof msg === "function" ) msg = msg ( ) ;
42974420 msg = msg || '' ;
42984421 msg = msg
4299- . replace ( / # { this} / g, objDisplay ( val ) )
4300- . replace ( / # { act} / g, objDisplay ( actual ) )
4301- . replace ( / # { exp} / g, objDisplay ( expected ) ) ;
4422+ . replace ( / # \ {t h i s \ }/ g, function ( ) { return objDisplay ( val ) ; } )
4423+ . replace ( / # \ {a c t \ }/ g, function ( ) { return objDisplay ( actual ) ; } )
4424+ . replace ( / # \ {e x p \ }/ g, function ( ) { return objDisplay ( expected ) ; } ) ;
43024425
43034426 return flagMsg ? flagMsg + ': ' + msg : msg ;
43044427} ;
0 commit comments