chai 3.2.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CODE_OF_CONDUCT.md +58 -0
- package/CONTRIBUTING.md +11 -3
- package/README.md +3 -1
- package/chai.js +593 -73
- package/lib/chai/assertion.js +2 -2
- package/lib/chai/core/assertions.js +148 -17
- package/lib/chai/interface/assert.js +225 -18
- package/lib/chai/interface/expect.js +1 -0
- package/lib/chai/interface/should.js +103 -0
- package/lib/chai/utils/addChainableMethod.js +1 -0
- package/lib/chai/utils/addMethod.js +1 -0
- package/lib/chai/utils/addProperty.js +9 -1
- package/lib/chai/utils/expectTypes.js +42 -0
- package/lib/chai/utils/flag.js +1 -0
- package/lib/chai/utils/getActual.js +2 -0
- package/lib/chai/utils/getEnumerableProperties.js +1 -0
- package/lib/chai/utils/getMessage.js +4 -3
- package/lib/chai/utils/getName.js +2 -0
- package/lib/chai/utils/getPathInfo.js +1 -0
- package/lib/chai/utils/getPathValue.js +2 -1
- package/lib/chai/utils/getProperties.js +1 -0
- package/lib/chai/utils/hasProperty.js +2 -1
- package/lib/chai/utils/index.js +5 -1
- package/lib/chai/utils/inspect.js +2 -0
- package/lib/chai/utils/objDisplay.js +1 -0
- package/lib/chai/utils/overwriteChainableMethod.js +1 -0
- package/lib/chai/utils/overwriteMethod.js +1 -0
- package/lib/chai/utils/overwriteProperty.js +1 -0
- package/lib/chai/utils/test.js +2 -0
- package/lib/chai/utils/transferFlags.js +1 -0
- package/lib/chai.js +1 -1
- package/package.json +2 -2
package/chai.js
CHANGED
|
@@ -15,7 +15,7 @@ var used = []
|
|
|
15
15
|
* Chai version
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
exports.version = '3.
|
|
18
|
+
exports.version = '3.5.0';
|
|
19
19
|
|
|
20
20
|
/*!
|
|
21
21
|
* Assertion Error
|
|
@@ -96,7 +96,7 @@ exports.use(should);
|
|
|
96
96
|
var assert = require('./chai/interface/assert');
|
|
97
97
|
exports.use(assert);
|
|
98
98
|
|
|
99
|
-
},{"./chai/assertion":3,"./chai/config":4,"./chai/core/assertions":5,"./chai/interface/assert":6,"./chai/interface/expect":7,"./chai/interface/should":8,"./chai/utils":
|
|
99
|
+
},{"./chai/assertion":3,"./chai/config":4,"./chai/core/assertions":5,"./chai/interface/assert":6,"./chai/interface/expect":7,"./chai/interface/should":8,"./chai/utils":22,"assertion-error":30}],3:[function(require,module,exports){
|
|
100
100
|
/*!
|
|
101
101
|
* chai
|
|
102
102
|
* http://chaijs.com
|
|
@@ -187,8 +187,8 @@ module.exports = function (_chai, util) {
|
|
|
187
187
|
*
|
|
188
188
|
* @name assert
|
|
189
189
|
* @param {Philosophical} expression to be tested
|
|
190
|
-
* @param {String
|
|
191
|
-
* @param {String
|
|
190
|
+
* @param {String|Function} message or function that returns message to display if expression fails
|
|
191
|
+
* @param {String|Function} negatedMessage or function that returns negatedMessage to display if negated expression fails
|
|
192
192
|
* @param {Mixed} expected value (remember to check for negation)
|
|
193
193
|
* @param {Mixed} actual (optional) will default to `this.obj`
|
|
194
194
|
* @param {Boolean} showDiff (optional) when set to `true`, assert will display a diff in addition to the message if expression fails
|
|
@@ -324,6 +324,7 @@ module.exports = function (chai, _) {
|
|
|
324
324
|
* - same
|
|
325
325
|
*
|
|
326
326
|
* @name language chains
|
|
327
|
+
* @namespace BDD
|
|
327
328
|
* @api public
|
|
328
329
|
*/
|
|
329
330
|
|
|
@@ -347,6 +348,7 @@ module.exports = function (chai, _) {
|
|
|
347
348
|
* .and.not.equal('bar');
|
|
348
349
|
*
|
|
349
350
|
* @name not
|
|
351
|
+
* @namespace BDD
|
|
350
352
|
* @api public
|
|
351
353
|
*/
|
|
352
354
|
|
|
@@ -371,6 +373,7 @@ module.exports = function (chai, _) {
|
|
|
371
373
|
* expect(deepCss).to.have.deep.property('\\.link.\\[target\\]', 42);
|
|
372
374
|
*
|
|
373
375
|
* @name deep
|
|
376
|
+
* @namespace BDD
|
|
374
377
|
* @api public
|
|
375
378
|
*/
|
|
376
379
|
|
|
@@ -387,6 +390,7 @@ module.exports = function (chai, _) {
|
|
|
387
390
|
* expect(foo).to.have.any.keys('bar', 'baz');
|
|
388
391
|
*
|
|
389
392
|
* @name any
|
|
393
|
+
* @namespace BDD
|
|
390
394
|
* @api public
|
|
391
395
|
*/
|
|
392
396
|
|
|
@@ -405,6 +409,7 @@ module.exports = function (chai, _) {
|
|
|
405
409
|
* expect(foo).to.have.all.keys('bar', 'baz');
|
|
406
410
|
*
|
|
407
411
|
* @name all
|
|
412
|
+
* @namespace BDD
|
|
408
413
|
* @api public
|
|
409
414
|
*/
|
|
410
415
|
|
|
@@ -425,6 +430,7 @@ module.exports = function (chai, _) {
|
|
|
425
430
|
* expect({ foo: 'bar' }).to.be.an('object');
|
|
426
431
|
* expect(null).to.be.a('null');
|
|
427
432
|
* expect(undefined).to.be.an('undefined');
|
|
433
|
+
* expect(new Error).to.be.an('error');
|
|
428
434
|
* expect(new Promise).to.be.a('promise');
|
|
429
435
|
* expect(new Float32Array()).to.be.a('float32array');
|
|
430
436
|
* expect(Symbol()).to.be.a('symbol');
|
|
@@ -439,6 +445,7 @@ module.exports = function (chai, _) {
|
|
|
439
445
|
* @alias an
|
|
440
446
|
* @param {String} type
|
|
441
447
|
* @param {String} message _optional_
|
|
448
|
+
* @namespace BDD
|
|
442
449
|
* @api public
|
|
443
450
|
*/
|
|
444
451
|
|
|
@@ -476,6 +483,7 @@ module.exports = function (chai, _) {
|
|
|
476
483
|
* @alias contains
|
|
477
484
|
* @param {Object|String|Number} obj
|
|
478
485
|
* @param {String} message _optional_
|
|
486
|
+
* @namespace BDD
|
|
479
487
|
* @api public
|
|
480
488
|
*/
|
|
481
489
|
|
|
@@ -484,9 +492,12 @@ module.exports = function (chai, _) {
|
|
|
484
492
|
}
|
|
485
493
|
|
|
486
494
|
function include (val, msg) {
|
|
495
|
+
_.expectTypes(this, ['array', 'object', 'string']);
|
|
496
|
+
|
|
487
497
|
if (msg) flag(this, 'message', msg);
|
|
488
498
|
var obj = flag(this, 'object');
|
|
489
499
|
var expected = false;
|
|
500
|
+
|
|
490
501
|
if (_.type(obj) === 'array' && _.type(val) === 'object') {
|
|
491
502
|
for (var i in obj) {
|
|
492
503
|
if (_.eql(obj[i], val)) {
|
|
@@ -503,7 +514,7 @@ module.exports = function (chai, _) {
|
|
|
503
514
|
for (var k in val) subset[k] = obj[k];
|
|
504
515
|
expected = _.eql(subset, val);
|
|
505
516
|
} else {
|
|
506
|
-
expected = obj && ~obj.indexOf(val);
|
|
517
|
+
expected = (obj != undefined) && ~obj.indexOf(val);
|
|
507
518
|
}
|
|
508
519
|
this.assert(
|
|
509
520
|
expected
|
|
@@ -521,13 +532,14 @@ module.exports = function (chai, _) {
|
|
|
521
532
|
*
|
|
522
533
|
* Asserts that the target is truthy.
|
|
523
534
|
*
|
|
524
|
-
* expect('
|
|
535
|
+
* expect('everything').to.be.ok;
|
|
525
536
|
* expect(1).to.be.ok;
|
|
526
537
|
* expect(false).to.not.be.ok;
|
|
527
538
|
* expect(undefined).to.not.be.ok;
|
|
528
539
|
* expect(null).to.not.be.ok;
|
|
529
540
|
*
|
|
530
541
|
* @name ok
|
|
542
|
+
* @namespace BDD
|
|
531
543
|
* @api public
|
|
532
544
|
*/
|
|
533
545
|
|
|
@@ -547,6 +559,7 @@ module.exports = function (chai, _) {
|
|
|
547
559
|
* expect(1).to.not.be.true;
|
|
548
560
|
*
|
|
549
561
|
* @name true
|
|
562
|
+
* @namespace BDD
|
|
550
563
|
* @api public
|
|
551
564
|
*/
|
|
552
565
|
|
|
@@ -568,6 +581,7 @@ module.exports = function (chai, _) {
|
|
|
568
581
|
* expect(0).to.not.be.false;
|
|
569
582
|
*
|
|
570
583
|
* @name false
|
|
584
|
+
* @namespace BDD
|
|
571
585
|
* @api public
|
|
572
586
|
*/
|
|
573
587
|
|
|
@@ -589,6 +603,7 @@ module.exports = function (chai, _) {
|
|
|
589
603
|
* expect(undefined).to.not.be.null;
|
|
590
604
|
*
|
|
591
605
|
* @name null
|
|
606
|
+
* @namespace BDD
|
|
592
607
|
* @api public
|
|
593
608
|
*/
|
|
594
609
|
|
|
@@ -609,6 +624,7 @@ module.exports = function (chai, _) {
|
|
|
609
624
|
* expect(null).to.not.be.undefined;
|
|
610
625
|
*
|
|
611
626
|
* @name undefined
|
|
627
|
+
* @namespace BDD
|
|
612
628
|
* @api public
|
|
613
629
|
*/
|
|
614
630
|
|
|
@@ -628,6 +644,7 @@ module.exports = function (chai, _) {
|
|
|
628
644
|
* expect(4).not.to.be.NaN;
|
|
629
645
|
*
|
|
630
646
|
* @name NaN
|
|
647
|
+
* @namespace BDD
|
|
631
648
|
* @api public
|
|
632
649
|
*/
|
|
633
650
|
|
|
@@ -653,6 +670,7 @@ module.exports = function (chai, _) {
|
|
|
653
670
|
* expect(baz).to.not.exist;
|
|
654
671
|
*
|
|
655
672
|
* @name exist
|
|
673
|
+
* @namespace BDD
|
|
656
674
|
* @api public
|
|
657
675
|
*/
|
|
658
676
|
|
|
@@ -677,6 +695,7 @@ module.exports = function (chai, _) {
|
|
|
677
695
|
* expect({}).to.be.empty;
|
|
678
696
|
*
|
|
679
697
|
* @name empty
|
|
698
|
+
* @namespace BDD
|
|
680
699
|
* @api public
|
|
681
700
|
*/
|
|
682
701
|
|
|
@@ -708,6 +727,7 @@ module.exports = function (chai, _) {
|
|
|
708
727
|
*
|
|
709
728
|
* @name arguments
|
|
710
729
|
* @alias Arguments
|
|
730
|
+
* @namespace BDD
|
|
711
731
|
* @api public
|
|
712
732
|
*/
|
|
713
733
|
|
|
@@ -743,6 +763,7 @@ module.exports = function (chai, _) {
|
|
|
743
763
|
* @alias deep.equal
|
|
744
764
|
* @param {Mixed} value
|
|
745
765
|
* @param {String} message _optional_
|
|
766
|
+
* @namespace BDD
|
|
746
767
|
* @api public
|
|
747
768
|
*/
|
|
748
769
|
|
|
@@ -779,6 +800,7 @@ module.exports = function (chai, _) {
|
|
|
779
800
|
* @alias eqls
|
|
780
801
|
* @param {Mixed} value
|
|
781
802
|
* @param {String} message _optional_
|
|
803
|
+
* @namespace BDD
|
|
782
804
|
* @api public
|
|
783
805
|
*/
|
|
784
806
|
|
|
@@ -817,6 +839,7 @@ module.exports = function (chai, _) {
|
|
|
817
839
|
* @alias greaterThan
|
|
818
840
|
* @param {Number} value
|
|
819
841
|
* @param {String} message _optional_
|
|
842
|
+
* @namespace BDD
|
|
820
843
|
* @api public
|
|
821
844
|
*/
|
|
822
845
|
|
|
@@ -865,6 +888,7 @@ module.exports = function (chai, _) {
|
|
|
865
888
|
* @alias gte
|
|
866
889
|
* @param {Number} value
|
|
867
890
|
* @param {String} message _optional_
|
|
891
|
+
* @namespace BDD
|
|
868
892
|
* @api public
|
|
869
893
|
*/
|
|
870
894
|
|
|
@@ -913,6 +937,7 @@ module.exports = function (chai, _) {
|
|
|
913
937
|
* @alias lessThan
|
|
914
938
|
* @param {Number} value
|
|
915
939
|
* @param {String} message _optional_
|
|
940
|
+
* @namespace BDD
|
|
916
941
|
* @api public
|
|
917
942
|
*/
|
|
918
943
|
|
|
@@ -961,6 +986,7 @@ module.exports = function (chai, _) {
|
|
|
961
986
|
* @alias lte
|
|
962
987
|
* @param {Number} value
|
|
963
988
|
* @param {String} message _optional_
|
|
989
|
+
* @namespace BDD
|
|
964
990
|
* @api public
|
|
965
991
|
*/
|
|
966
992
|
|
|
@@ -1008,6 +1034,7 @@ module.exports = function (chai, _) {
|
|
|
1008
1034
|
* @param {Number} start lowerbound inclusive
|
|
1009
1035
|
* @param {Number} finish upperbound inclusive
|
|
1010
1036
|
* @param {String} message _optional_
|
|
1037
|
+
* @namespace BDD
|
|
1011
1038
|
* @api public
|
|
1012
1039
|
*/
|
|
1013
1040
|
|
|
@@ -1047,6 +1074,7 @@ module.exports = function (chai, _) {
|
|
|
1047
1074
|
* @param {Constructor} constructor
|
|
1048
1075
|
* @param {String} message _optional_
|
|
1049
1076
|
* @alias instanceOf
|
|
1077
|
+
* @namespace BDD
|
|
1050
1078
|
* @api public
|
|
1051
1079
|
*/
|
|
1052
1080
|
|
|
@@ -1131,6 +1159,7 @@ module.exports = function (chai, _) {
|
|
|
1131
1159
|
* @param {Mixed} value (optional)
|
|
1132
1160
|
* @param {String} message _optional_
|
|
1133
1161
|
* @returns value of property for chaining
|
|
1162
|
+
* @namespace BDD
|
|
1134
1163
|
* @api public
|
|
1135
1164
|
*/
|
|
1136
1165
|
|
|
@@ -1186,6 +1215,7 @@ module.exports = function (chai, _) {
|
|
|
1186
1215
|
* @alias haveOwnProperty
|
|
1187
1216
|
* @param {String} name
|
|
1188
1217
|
* @param {String} message _optional_
|
|
1218
|
+
* @namespace BDD
|
|
1189
1219
|
* @api public
|
|
1190
1220
|
*/
|
|
1191
1221
|
|
|
@@ -1218,6 +1248,7 @@ module.exports = function (chai, _) {
|
|
|
1218
1248
|
* @param {String} name
|
|
1219
1249
|
* @param {Object} descriptor _optional_
|
|
1220
1250
|
* @param {String} message _optional_
|
|
1251
|
+
* @namespace BDD
|
|
1221
1252
|
* @api public
|
|
1222
1253
|
*/
|
|
1223
1254
|
|
|
@@ -1270,6 +1301,7 @@ module.exports = function (chai, _) {
|
|
|
1270
1301
|
* switched to use `lengthOf(value)` instead.
|
|
1271
1302
|
*
|
|
1272
1303
|
* @name length
|
|
1304
|
+
* @namespace BDD
|
|
1273
1305
|
* @api public
|
|
1274
1306
|
*/
|
|
1275
1307
|
|
|
@@ -1285,6 +1317,7 @@ module.exports = function (chai, _) {
|
|
|
1285
1317
|
* @name lengthOf
|
|
1286
1318
|
* @param {Number} length
|
|
1287
1319
|
* @param {String} message _optional_
|
|
1320
|
+
* @namespace BDD
|
|
1288
1321
|
* @api public
|
|
1289
1322
|
*/
|
|
1290
1323
|
|
|
@@ -1321,6 +1354,7 @@ module.exports = function (chai, _) {
|
|
|
1321
1354
|
* @alias matches
|
|
1322
1355
|
* @param {RegExp} RegularExpression
|
|
1323
1356
|
* @param {String} message _optional_
|
|
1357
|
+
* @namespace BDD
|
|
1324
1358
|
* @api public
|
|
1325
1359
|
*/
|
|
1326
1360
|
function assertMatch(re, msg) {
|
|
@@ -1346,6 +1380,7 @@ module.exports = function (chai, _) {
|
|
|
1346
1380
|
* @name string
|
|
1347
1381
|
* @param {String} string
|
|
1348
1382
|
* @param {String} message _optional_
|
|
1383
|
+
* @namespace BDD
|
|
1349
1384
|
* @api public
|
|
1350
1385
|
*/
|
|
1351
1386
|
|
|
@@ -1396,7 +1431,8 @@ module.exports = function (chai, _) {
|
|
|
1396
1431
|
*
|
|
1397
1432
|
* @name keys
|
|
1398
1433
|
* @alias key
|
|
1399
|
-
* @param {String
|
|
1434
|
+
* @param {...String|Array|Object} keys
|
|
1435
|
+
* @namespace BDD
|
|
1400
1436
|
* @api public
|
|
1401
1437
|
*/
|
|
1402
1438
|
|
|
@@ -1499,7 +1535,6 @@ module.exports = function (chai, _) {
|
|
|
1499
1535
|
* expect(fn).to.not.throw('good function');
|
|
1500
1536
|
* expect(fn).to.throw(ReferenceError, /bad function/);
|
|
1501
1537
|
* expect(fn).to.throw(err);
|
|
1502
|
-
* expect(fn).to.not.throw(new RangeError('Out of range.'));
|
|
1503
1538
|
*
|
|
1504
1539
|
* Please note that when a throw expectation is negated, it will check each
|
|
1505
1540
|
* parameter independently, starting with error constructor type. The appropriate way
|
|
@@ -1517,6 +1552,7 @@ module.exports = function (chai, _) {
|
|
|
1517
1552
|
* @param {String} message _optional_
|
|
1518
1553
|
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
|
1519
1554
|
* @returns error for chaining (null if no error)
|
|
1555
|
+
* @namespace BDD
|
|
1520
1556
|
* @api public
|
|
1521
1557
|
*/
|
|
1522
1558
|
|
|
@@ -1541,9 +1577,9 @@ module.exports = function (chai, _) {
|
|
|
1541
1577
|
constructor = null;
|
|
1542
1578
|
errMsg = null;
|
|
1543
1579
|
} else if (typeof constructor === 'function') {
|
|
1544
|
-
name = constructor.prototype.name
|
|
1545
|
-
if (name === 'Error' && constructor !== Error) {
|
|
1546
|
-
name = (new constructor()).name;
|
|
1580
|
+
name = constructor.prototype.name;
|
|
1581
|
+
if (!name || (name === 'Error' && constructor !== Error)) {
|
|
1582
|
+
name = constructor.name || (new constructor()).name;
|
|
1547
1583
|
}
|
|
1548
1584
|
} else {
|
|
1549
1585
|
constructor = null;
|
|
@@ -1660,6 +1696,7 @@ module.exports = function (chai, _) {
|
|
|
1660
1696
|
* @alias respondsTo
|
|
1661
1697
|
* @param {String} method
|
|
1662
1698
|
* @param {String} message _optional_
|
|
1699
|
+
* @namespace BDD
|
|
1663
1700
|
* @api public
|
|
1664
1701
|
*/
|
|
1665
1702
|
|
|
@@ -1694,6 +1731,7 @@ module.exports = function (chai, _) {
|
|
|
1694
1731
|
* expect(Foo).itself.not.to.respondTo('baz');
|
|
1695
1732
|
*
|
|
1696
1733
|
* @name itself
|
|
1734
|
+
* @namespace BDD
|
|
1697
1735
|
* @api public
|
|
1698
1736
|
*/
|
|
1699
1737
|
|
|
@@ -1712,6 +1750,7 @@ module.exports = function (chai, _) {
|
|
|
1712
1750
|
* @alias satisfies
|
|
1713
1751
|
* @param {Function} matcher
|
|
1714
1752
|
* @param {String} message _optional_
|
|
1753
|
+
* @namespace BDD
|
|
1715
1754
|
* @api public
|
|
1716
1755
|
*/
|
|
1717
1756
|
|
|
@@ -1727,7 +1766,7 @@ module.exports = function (chai, _) {
|
|
|
1727
1766
|
, result
|
|
1728
1767
|
);
|
|
1729
1768
|
}
|
|
1730
|
-
|
|
1769
|
+
|
|
1731
1770
|
Assertion.addMethod('satisfy', satisfy);
|
|
1732
1771
|
Assertion.addMethod('satisfies', satisfy);
|
|
1733
1772
|
|
|
@@ -1739,19 +1778,21 @@ module.exports = function (chai, _) {
|
|
|
1739
1778
|
* expect(1.5).to.be.closeTo(1, 0.5);
|
|
1740
1779
|
*
|
|
1741
1780
|
* @name closeTo
|
|
1781
|
+
* @alias approximately
|
|
1742
1782
|
* @param {Number} expected
|
|
1743
1783
|
* @param {Number} delta
|
|
1744
1784
|
* @param {String} message _optional_
|
|
1785
|
+
* @namespace BDD
|
|
1745
1786
|
* @api public
|
|
1746
1787
|
*/
|
|
1747
1788
|
|
|
1748
|
-
|
|
1789
|
+
function closeTo(expected, delta, msg) {
|
|
1749
1790
|
if (msg) flag(this, 'message', msg);
|
|
1750
1791
|
var obj = flag(this, 'object');
|
|
1751
1792
|
|
|
1752
1793
|
new Assertion(obj, msg).is.a('number');
|
|
1753
1794
|
if (_.type(expected) !== 'number' || _.type(delta) !== 'number') {
|
|
1754
|
-
throw new Error('the arguments to closeTo must be numbers');
|
|
1795
|
+
throw new Error('the arguments to closeTo or approximately must be numbers');
|
|
1755
1796
|
}
|
|
1756
1797
|
|
|
1757
1798
|
this.assert(
|
|
@@ -1759,7 +1800,10 @@ module.exports = function (chai, _) {
|
|
|
1759
1800
|
, 'expected #{this} to be close to ' + expected + ' +/- ' + delta
|
|
1760
1801
|
, 'expected #{this} not to be close to ' + expected + ' +/- ' + delta
|
|
1761
1802
|
);
|
|
1762
|
-
}
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
Assertion.addMethod('closeTo', closeTo);
|
|
1806
|
+
Assertion.addMethod('approximately', closeTo);
|
|
1763
1807
|
|
|
1764
1808
|
function isSubsetOf(subset, superset, cmp) {
|
|
1765
1809
|
return subset.every(function(elem) {
|
|
@@ -1790,6 +1834,7 @@ module.exports = function (chai, _) {
|
|
|
1790
1834
|
* @name members
|
|
1791
1835
|
* @param {Array} set
|
|
1792
1836
|
* @param {String} message _optional_
|
|
1837
|
+
* @namespace BDD
|
|
1793
1838
|
* @api public
|
|
1794
1839
|
*/
|
|
1795
1840
|
|
|
@@ -1821,6 +1866,45 @@ module.exports = function (chai, _) {
|
|
|
1821
1866
|
);
|
|
1822
1867
|
});
|
|
1823
1868
|
|
|
1869
|
+
/**
|
|
1870
|
+
* ### .oneOf(list)
|
|
1871
|
+
*
|
|
1872
|
+
* Assert that a value appears somewhere in the top level of array `list`.
|
|
1873
|
+
*
|
|
1874
|
+
* expect('a').to.be.oneOf(['a', 'b', 'c']);
|
|
1875
|
+
* expect(9).to.not.be.oneOf(['z']);
|
|
1876
|
+
* expect([3]).to.not.be.oneOf([1, 2, [3]]);
|
|
1877
|
+
*
|
|
1878
|
+
* var three = [3];
|
|
1879
|
+
* // for object-types, contents are not compared
|
|
1880
|
+
* expect(three).to.not.be.oneOf([1, 2, [3]]);
|
|
1881
|
+
* // comparing references works
|
|
1882
|
+
* expect(three).to.be.oneOf([1, 2, three]);
|
|
1883
|
+
*
|
|
1884
|
+
* @name oneOf
|
|
1885
|
+
* @param {Array<*>} list
|
|
1886
|
+
* @param {String} message _optional_
|
|
1887
|
+
* @namespace BDD
|
|
1888
|
+
* @api public
|
|
1889
|
+
*/
|
|
1890
|
+
|
|
1891
|
+
function oneOf (list, msg) {
|
|
1892
|
+
if (msg) flag(this, 'message', msg);
|
|
1893
|
+
var expected = flag(this, 'object');
|
|
1894
|
+
new Assertion(list).to.be.an('array');
|
|
1895
|
+
|
|
1896
|
+
this.assert(
|
|
1897
|
+
list.indexOf(expected) > -1
|
|
1898
|
+
, 'expected #{this} to be one of #{exp}'
|
|
1899
|
+
, 'expected #{this} to not be one of #{exp}'
|
|
1900
|
+
, list
|
|
1901
|
+
, expected
|
|
1902
|
+
);
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
Assertion.addMethod('oneOf', oneOf);
|
|
1906
|
+
|
|
1907
|
+
|
|
1824
1908
|
/**
|
|
1825
1909
|
* ### .change(function)
|
|
1826
1910
|
*
|
|
@@ -1830,7 +1914,7 @@ module.exports = function (chai, _) {
|
|
|
1830
1914
|
* var fn = function() { obj.val += 3 };
|
|
1831
1915
|
* var noChangeFn = function() { return 'foo' + 'bar'; }
|
|
1832
1916
|
* expect(fn).to.change(obj, 'val');
|
|
1833
|
-
* expect(
|
|
1917
|
+
* expect(noChangeFn).to.not.change(obj, 'val')
|
|
1834
1918
|
*
|
|
1835
1919
|
* @name change
|
|
1836
1920
|
* @alias changes
|
|
@@ -1838,6 +1922,7 @@ module.exports = function (chai, _) {
|
|
|
1838
1922
|
* @param {String} object
|
|
1839
1923
|
* @param {String} property name
|
|
1840
1924
|
* @param {String} message _optional_
|
|
1925
|
+
* @namespace BDD
|
|
1841
1926
|
* @api public
|
|
1842
1927
|
*/
|
|
1843
1928
|
|
|
@@ -1875,6 +1960,7 @@ module.exports = function (chai, _) {
|
|
|
1875
1960
|
* @param {String} object
|
|
1876
1961
|
* @param {String} property name
|
|
1877
1962
|
* @param {String} message _optional_
|
|
1963
|
+
* @namespace BDD
|
|
1878
1964
|
* @api public
|
|
1879
1965
|
*/
|
|
1880
1966
|
|
|
@@ -1912,6 +1998,7 @@ module.exports = function (chai, _) {
|
|
|
1912
1998
|
* @param {String} object
|
|
1913
1999
|
* @param {String} property name
|
|
1914
2000
|
* @param {String} message _optional_
|
|
2001
|
+
* @namespace BDD
|
|
1915
2002
|
* @api public
|
|
1916
2003
|
*/
|
|
1917
2004
|
|
|
@@ -1937,7 +2024,7 @@ module.exports = function (chai, _) {
|
|
|
1937
2024
|
/**
|
|
1938
2025
|
* ### .extensible
|
|
1939
2026
|
*
|
|
1940
|
-
* Asserts that the target is extensible (can have new properties added to
|
|
2027
|
+
* Asserts that the target is extensible (can have new properties added to
|
|
1941
2028
|
* it).
|
|
1942
2029
|
*
|
|
1943
2030
|
* var nonExtensibleObject = Object.preventExtensions({});
|
|
@@ -1950,14 +2037,29 @@ module.exports = function (chai, _) {
|
|
|
1950
2037
|
* expect(frozenObject).to.not.be.extensible;
|
|
1951
2038
|
*
|
|
1952
2039
|
* @name extensible
|
|
2040
|
+
* @namespace BDD
|
|
1953
2041
|
* @api public
|
|
1954
2042
|
*/
|
|
1955
2043
|
|
|
1956
2044
|
Assertion.addProperty('extensible', function() {
|
|
1957
2045
|
var obj = flag(this, 'object');
|
|
1958
2046
|
|
|
2047
|
+
// In ES5, if the argument to this method is not an object (a primitive), then it will cause a TypeError.
|
|
2048
|
+
// In ES6, a non-object argument will be treated as if it was a non-extensible ordinary object, simply return false.
|
|
2049
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible
|
|
2050
|
+
// The following provides ES6 behavior when a TypeError is thrown under ES5.
|
|
2051
|
+
|
|
2052
|
+
var isExtensible;
|
|
2053
|
+
|
|
2054
|
+
try {
|
|
2055
|
+
isExtensible = Object.isExtensible(obj);
|
|
2056
|
+
} catch (err) {
|
|
2057
|
+
if (err instanceof TypeError) isExtensible = false;
|
|
2058
|
+
else throw err;
|
|
2059
|
+
}
|
|
2060
|
+
|
|
1959
2061
|
this.assert(
|
|
1960
|
-
|
|
2062
|
+
isExtensible
|
|
1961
2063
|
, 'expected #{this} to be extensible'
|
|
1962
2064
|
, 'expected #{this} to not be extensible'
|
|
1963
2065
|
);
|
|
@@ -1977,14 +2079,29 @@ module.exports = function (chai, _) {
|
|
|
1977
2079
|
* expect({}).to.not.be.sealed;
|
|
1978
2080
|
*
|
|
1979
2081
|
* @name sealed
|
|
2082
|
+
* @namespace BDD
|
|
1980
2083
|
* @api public
|
|
1981
2084
|
*/
|
|
1982
2085
|
|
|
1983
2086
|
Assertion.addProperty('sealed', function() {
|
|
1984
2087
|
var obj = flag(this, 'object');
|
|
1985
2088
|
|
|
2089
|
+
// In ES5, if the argument to this method is not an object (a primitive), then it will cause a TypeError.
|
|
2090
|
+
// In ES6, a non-object argument will be treated as if it was a sealed ordinary object, simply return true.
|
|
2091
|
+
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isSealed
|
|
2092
|
+
// The following provides ES6 behavior when a TypeError is thrown under ES5.
|
|
2093
|
+
|
|
2094
|
+
var isSealed;
|
|
2095
|
+
|
|
2096
|
+
try {
|
|
2097
|
+
isSealed = Object.isSealed(obj);
|
|
2098
|
+
} catch (err) {
|
|
2099
|
+
if (err instanceof TypeError) isSealed = true;
|
|
2100
|
+
else throw err;
|
|
2101
|
+
}
|
|
2102
|
+
|
|
1986
2103
|
this.assert(
|
|
1987
|
-
|
|
2104
|
+
isSealed
|
|
1988
2105
|
, 'expected #{this} to be sealed'
|
|
1989
2106
|
, 'expected #{this} to not be sealed'
|
|
1990
2107
|
);
|
|
@@ -2002,19 +2119,33 @@ module.exports = function (chai, _) {
|
|
|
2002
2119
|
* expect({}).to.not.be.frozen;
|
|
2003
2120
|
*
|
|
2004
2121
|
* @name frozen
|
|
2122
|
+
* @namespace BDD
|
|
2005
2123
|
* @api public
|
|
2006
2124
|
*/
|
|
2007
2125
|
|
|
2008
2126
|
Assertion.addProperty('frozen', function() {
|
|
2009
2127
|
var obj = flag(this, 'object');
|
|
2010
2128
|
|
|
2129
|
+
// In ES5, if the argument to this method is not an object (a primitive), then it will cause a TypeError.
|
|
2130
|
+
// In ES6, a non-object argument will be treated as if it was a frozen ordinary object, simply return true.
|
|
2131
|
+
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen
|
|
2132
|
+
// The following provides ES6 behavior when a TypeError is thrown under ES5.
|
|
2133
|
+
|
|
2134
|
+
var isFrozen;
|
|
2135
|
+
|
|
2136
|
+
try {
|
|
2137
|
+
isFrozen = Object.isFrozen(obj);
|
|
2138
|
+
} catch (err) {
|
|
2139
|
+
if (err instanceof TypeError) isFrozen = true;
|
|
2140
|
+
else throw err;
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2011
2143
|
this.assert(
|
|
2012
|
-
|
|
2144
|
+
isFrozen
|
|
2013
2145
|
, 'expected #{this} to be frozen'
|
|
2014
2146
|
, 'expected #{this} to not be frozen'
|
|
2015
2147
|
);
|
|
2016
2148
|
});
|
|
2017
|
-
|
|
2018
2149
|
};
|
|
2019
2150
|
|
|
2020
2151
|
},{}],6:[function(require,module,exports){
|
|
@@ -2049,6 +2180,7 @@ module.exports = function (chai, util) {
|
|
|
2049
2180
|
* @param {Mixed} expression to test for truthiness
|
|
2050
2181
|
* @param {String} message to display on error
|
|
2051
2182
|
* @name assert
|
|
2183
|
+
* @namespace Assert
|
|
2052
2184
|
* @api public
|
|
2053
2185
|
*/
|
|
2054
2186
|
|
|
@@ -2071,6 +2203,7 @@ module.exports = function (chai, util) {
|
|
|
2071
2203
|
* @param {Mixed} expected
|
|
2072
2204
|
* @param {String} message
|
|
2073
2205
|
* @param {String} operator
|
|
2206
|
+
* @namespace Assert
|
|
2074
2207
|
* @api public
|
|
2075
2208
|
*/
|
|
2076
2209
|
|
|
@@ -2095,6 +2228,7 @@ module.exports = function (chai, util) {
|
|
|
2095
2228
|
* @alias ok
|
|
2096
2229
|
* @param {Mixed} object to test
|
|
2097
2230
|
* @param {String} message
|
|
2231
|
+
* @namespace Assert
|
|
2098
2232
|
* @api public
|
|
2099
2233
|
*/
|
|
2100
2234
|
|
|
@@ -2114,6 +2248,7 @@ module.exports = function (chai, util) {
|
|
|
2114
2248
|
* @alias notOk
|
|
2115
2249
|
* @param {Mixed} object to test
|
|
2116
2250
|
* @param {String} message
|
|
2251
|
+
* @namespace Assert
|
|
2117
2252
|
* @api public
|
|
2118
2253
|
*/
|
|
2119
2254
|
|
|
@@ -2132,6 +2267,7 @@ module.exports = function (chai, util) {
|
|
|
2132
2267
|
* @param {Mixed} actual
|
|
2133
2268
|
* @param {Mixed} expected
|
|
2134
2269
|
* @param {String} message
|
|
2270
|
+
* @namespace Assert
|
|
2135
2271
|
* @api public
|
|
2136
2272
|
*/
|
|
2137
2273
|
|
|
@@ -2158,6 +2294,7 @@ module.exports = function (chai, util) {
|
|
|
2158
2294
|
* @param {Mixed} actual
|
|
2159
2295
|
* @param {Mixed} expected
|
|
2160
2296
|
* @param {String} message
|
|
2297
|
+
* @namespace Assert
|
|
2161
2298
|
* @api public
|
|
2162
2299
|
*/
|
|
2163
2300
|
|
|
@@ -2184,6 +2321,7 @@ module.exports = function (chai, util) {
|
|
|
2184
2321
|
* @param {Mixed} actual
|
|
2185
2322
|
* @param {Mixed} expected
|
|
2186
2323
|
* @param {String} message
|
|
2324
|
+
* @namespace Assert
|
|
2187
2325
|
* @api public
|
|
2188
2326
|
*/
|
|
2189
2327
|
|
|
@@ -2202,6 +2340,7 @@ module.exports = function (chai, util) {
|
|
|
2202
2340
|
* @param {Mixed} actual
|
|
2203
2341
|
* @param {Mixed} expected
|
|
2204
2342
|
* @param {String} message
|
|
2343
|
+
* @namespace Assert
|
|
2205
2344
|
* @api public
|
|
2206
2345
|
*/
|
|
2207
2346
|
|
|
@@ -2220,6 +2359,7 @@ module.exports = function (chai, util) {
|
|
|
2220
2359
|
* @param {Mixed} actual
|
|
2221
2360
|
* @param {Mixed} expected
|
|
2222
2361
|
* @param {String} message
|
|
2362
|
+
* @namespace Assert
|
|
2223
2363
|
* @api public
|
|
2224
2364
|
*/
|
|
2225
2365
|
|
|
@@ -2238,6 +2378,7 @@ module.exports = function (chai, util) {
|
|
|
2238
2378
|
* @param {Mixed} actual
|
|
2239
2379
|
* @param {Mixed} expected
|
|
2240
2380
|
* @param {String} message
|
|
2381
|
+
* @namespace Assert
|
|
2241
2382
|
* @api public
|
|
2242
2383
|
*/
|
|
2243
2384
|
|
|
@@ -2245,17 +2386,18 @@ module.exports = function (chai, util) {
|
|
|
2245
2386
|
new Assertion(act, msg).to.not.eql(exp);
|
|
2246
2387
|
};
|
|
2247
2388
|
|
|
2248
|
-
|
|
2249
|
-
* ### .
|
|
2389
|
+
/**
|
|
2390
|
+
* ### .isAbove(valueToCheck, valueToBeAbove, [message])
|
|
2250
2391
|
*
|
|
2251
|
-
* Asserts
|
|
2392
|
+
* Asserts `valueToCheck` is strictly greater than (>) `valueToBeAbove`
|
|
2252
2393
|
*
|
|
2253
|
-
*
|
|
2254
|
-
* assert.isTrue(teaServed, 'the tea has been served');
|
|
2394
|
+
* assert.isAbove(5, 2, '5 is strictly greater than 2');
|
|
2255
2395
|
*
|
|
2256
|
-
* @name
|
|
2257
|
-
* @param {Mixed}
|
|
2396
|
+
* @name isAbove
|
|
2397
|
+
* @param {Mixed} valueToCheck
|
|
2398
|
+
* @param {Mixed} valueToBeAbove
|
|
2258
2399
|
* @param {String} message
|
|
2400
|
+
* @namespace Assert
|
|
2259
2401
|
* @api public
|
|
2260
2402
|
*/
|
|
2261
2403
|
|
|
@@ -2264,21 +2406,23 @@ module.exports = function (chai, util) {
|
|
|
2264
2406
|
};
|
|
2265
2407
|
|
|
2266
2408
|
/**
|
|
2267
|
-
* ### .
|
|
2409
|
+
* ### .isAtLeast(valueToCheck, valueToBeAtLeast, [message])
|
|
2268
2410
|
*
|
|
2269
|
-
* Asserts `valueToCheck` is
|
|
2411
|
+
* Asserts `valueToCheck` is greater than or equal to (>=) `valueToBeAtLeast`
|
|
2270
2412
|
*
|
|
2271
|
-
* assert.
|
|
2413
|
+
* assert.isAtLeast(5, 2, '5 is greater or equal to 2');
|
|
2414
|
+
* assert.isAtLeast(3, 3, '3 is greater or equal to 3');
|
|
2272
2415
|
*
|
|
2273
|
-
* @name
|
|
2416
|
+
* @name isAtLeast
|
|
2274
2417
|
* @param {Mixed} valueToCheck
|
|
2275
|
-
* @param {Mixed}
|
|
2418
|
+
* @param {Mixed} valueToBeAtLeast
|
|
2276
2419
|
* @param {String} message
|
|
2420
|
+
* @namespace Assert
|
|
2277
2421
|
* @api public
|
|
2278
2422
|
*/
|
|
2279
2423
|
|
|
2280
|
-
assert.
|
|
2281
|
-
new Assertion(val, msg).to.be.
|
|
2424
|
+
assert.isAtLeast = function (val, atlst, msg) {
|
|
2425
|
+
new Assertion(val, msg).to.be.least(atlst);
|
|
2282
2426
|
};
|
|
2283
2427
|
|
|
2284
2428
|
/**
|
|
@@ -2292,6 +2436,46 @@ module.exports = function (chai, util) {
|
|
|
2292
2436
|
* @param {Mixed} valueToCheck
|
|
2293
2437
|
* @param {Mixed} valueToBeBelow
|
|
2294
2438
|
* @param {String} message
|
|
2439
|
+
* @namespace Assert
|
|
2440
|
+
* @api public
|
|
2441
|
+
*/
|
|
2442
|
+
|
|
2443
|
+
assert.isBelow = function (val, blw, msg) {
|
|
2444
|
+
new Assertion(val, msg).to.be.below(blw);
|
|
2445
|
+
};
|
|
2446
|
+
|
|
2447
|
+
/**
|
|
2448
|
+
* ### .isAtMost(valueToCheck, valueToBeAtMost, [message])
|
|
2449
|
+
*
|
|
2450
|
+
* Asserts `valueToCheck` is less than or equal to (<=) `valueToBeAtMost`
|
|
2451
|
+
*
|
|
2452
|
+
* assert.isAtMost(3, 6, '3 is less than or equal to 6');
|
|
2453
|
+
* assert.isAtMost(4, 4, '4 is less than or equal to 4');
|
|
2454
|
+
*
|
|
2455
|
+
* @name isAtMost
|
|
2456
|
+
* @param {Mixed} valueToCheck
|
|
2457
|
+
* @param {Mixed} valueToBeAtMost
|
|
2458
|
+
* @param {String} message
|
|
2459
|
+
* @namespace Assert
|
|
2460
|
+
* @api public
|
|
2461
|
+
*/
|
|
2462
|
+
|
|
2463
|
+
assert.isAtMost = function (val, atmst, msg) {
|
|
2464
|
+
new Assertion(val, msg).to.be.most(atmst);
|
|
2465
|
+
};
|
|
2466
|
+
|
|
2467
|
+
/**
|
|
2468
|
+
* ### .isTrue(value, [message])
|
|
2469
|
+
*
|
|
2470
|
+
* Asserts that `value` is true.
|
|
2471
|
+
*
|
|
2472
|
+
* var teaServed = true;
|
|
2473
|
+
* assert.isTrue(teaServed, 'the tea has been served');
|
|
2474
|
+
*
|
|
2475
|
+
* @name isTrue
|
|
2476
|
+
* @param {Mixed} value
|
|
2477
|
+
* @param {String} message
|
|
2478
|
+
* @namespace Assert
|
|
2295
2479
|
* @api public
|
|
2296
2480
|
*/
|
|
2297
2481
|
|
|
@@ -2299,6 +2483,25 @@ module.exports = function (chai, util) {
|
|
|
2299
2483
|
new Assertion(val, msg).is['true'];
|
|
2300
2484
|
};
|
|
2301
2485
|
|
|
2486
|
+
/**
|
|
2487
|
+
* ### .isNotTrue(value, [message])
|
|
2488
|
+
*
|
|
2489
|
+
* Asserts that `value` is not true.
|
|
2490
|
+
*
|
|
2491
|
+
* var tea = 'tasty chai';
|
|
2492
|
+
* assert.isNotTrue(tea, 'great, time for tea!');
|
|
2493
|
+
*
|
|
2494
|
+
* @name isNotTrue
|
|
2495
|
+
* @param {Mixed} value
|
|
2496
|
+
* @param {String} message
|
|
2497
|
+
* @namespace Assert
|
|
2498
|
+
* @api public
|
|
2499
|
+
*/
|
|
2500
|
+
|
|
2501
|
+
assert.isNotTrue = function (val, msg) {
|
|
2502
|
+
new Assertion(val, msg).to.not.equal(true);
|
|
2503
|
+
};
|
|
2504
|
+
|
|
2302
2505
|
/**
|
|
2303
2506
|
* ### .isFalse(value, [message])
|
|
2304
2507
|
*
|
|
@@ -2310,6 +2513,7 @@ module.exports = function (chai, util) {
|
|
|
2310
2513
|
* @name isFalse
|
|
2311
2514
|
* @param {Mixed} value
|
|
2312
2515
|
* @param {String} message
|
|
2516
|
+
* @namespace Assert
|
|
2313
2517
|
* @api public
|
|
2314
2518
|
*/
|
|
2315
2519
|
|
|
@@ -2317,6 +2521,25 @@ module.exports = function (chai, util) {
|
|
|
2317
2521
|
new Assertion(val, msg).is['false'];
|
|
2318
2522
|
};
|
|
2319
2523
|
|
|
2524
|
+
/**
|
|
2525
|
+
* ### .isNotFalse(value, [message])
|
|
2526
|
+
*
|
|
2527
|
+
* Asserts that `value` is not false.
|
|
2528
|
+
*
|
|
2529
|
+
* var tea = 'tasty chai';
|
|
2530
|
+
* assert.isNotFalse(tea, 'great, time for tea!');
|
|
2531
|
+
*
|
|
2532
|
+
* @name isNotFalse
|
|
2533
|
+
* @param {Mixed} value
|
|
2534
|
+
* @param {String} message
|
|
2535
|
+
* @namespace Assert
|
|
2536
|
+
* @api public
|
|
2537
|
+
*/
|
|
2538
|
+
|
|
2539
|
+
assert.isNotFalse = function (val, msg) {
|
|
2540
|
+
new Assertion(val, msg).to.not.equal(false);
|
|
2541
|
+
};
|
|
2542
|
+
|
|
2320
2543
|
/**
|
|
2321
2544
|
* ### .isNull(value, [message])
|
|
2322
2545
|
*
|
|
@@ -2327,6 +2550,7 @@ module.exports = function (chai, util) {
|
|
|
2327
2550
|
* @name isNull
|
|
2328
2551
|
* @param {Mixed} value
|
|
2329
2552
|
* @param {String} message
|
|
2553
|
+
* @namespace Assert
|
|
2330
2554
|
* @api public
|
|
2331
2555
|
*/
|
|
2332
2556
|
|
|
@@ -2345,6 +2569,7 @@ module.exports = function (chai, util) {
|
|
|
2345
2569
|
* @name isNotNull
|
|
2346
2570
|
* @param {Mixed} value
|
|
2347
2571
|
* @param {String} message
|
|
2572
|
+
* @namespace Assert
|
|
2348
2573
|
* @api public
|
|
2349
2574
|
*/
|
|
2350
2575
|
|
|
@@ -2361,6 +2586,7 @@ module.exports = function (chai, util) {
|
|
|
2361
2586
|
* @name isNaN
|
|
2362
2587
|
* @param {Mixed} value
|
|
2363
2588
|
* @param {String} message
|
|
2589
|
+
* @namespace Assert
|
|
2364
2590
|
* @api public
|
|
2365
2591
|
*/
|
|
2366
2592
|
|
|
@@ -2377,6 +2603,7 @@ module.exports = function (chai, util) {
|
|
|
2377
2603
|
* @name isNotNaN
|
|
2378
2604
|
* @param {Mixed} value
|
|
2379
2605
|
* @param {String} message
|
|
2606
|
+
* @namespace Assert
|
|
2380
2607
|
* @api public
|
|
2381
2608
|
*/
|
|
2382
2609
|
assert.isNotNaN = function (val, msg) {
|
|
@@ -2394,6 +2621,7 @@ module.exports = function (chai, util) {
|
|
|
2394
2621
|
* @name isUndefined
|
|
2395
2622
|
* @param {Mixed} value
|
|
2396
2623
|
* @param {String} message
|
|
2624
|
+
* @namespace Assert
|
|
2397
2625
|
* @api public
|
|
2398
2626
|
*/
|
|
2399
2627
|
|
|
@@ -2412,6 +2640,7 @@ module.exports = function (chai, util) {
|
|
|
2412
2640
|
* @name isDefined
|
|
2413
2641
|
* @param {Mixed} value
|
|
2414
2642
|
* @param {String} message
|
|
2643
|
+
* @namespace Assert
|
|
2415
2644
|
* @api public
|
|
2416
2645
|
*/
|
|
2417
2646
|
|
|
@@ -2430,6 +2659,7 @@ module.exports = function (chai, util) {
|
|
|
2430
2659
|
* @name isFunction
|
|
2431
2660
|
* @param {Mixed} value
|
|
2432
2661
|
* @param {String} message
|
|
2662
|
+
* @namespace Assert
|
|
2433
2663
|
* @api public
|
|
2434
2664
|
*/
|
|
2435
2665
|
|
|
@@ -2448,6 +2678,7 @@ module.exports = function (chai, util) {
|
|
|
2448
2678
|
* @name isNotFunction
|
|
2449
2679
|
* @param {Mixed} value
|
|
2450
2680
|
* @param {String} message
|
|
2681
|
+
* @namespace Assert
|
|
2451
2682
|
* @api public
|
|
2452
2683
|
*/
|
|
2453
2684
|
|
|
@@ -2458,8 +2689,8 @@ module.exports = function (chai, util) {
|
|
|
2458
2689
|
/**
|
|
2459
2690
|
* ### .isObject(value, [message])
|
|
2460
2691
|
*
|
|
2461
|
-
* Asserts that `value` is an object (as revealed by
|
|
2462
|
-
*
|
|
2692
|
+
* Asserts that `value` is an object of type 'Object' (as revealed by `Object.prototype.toString`).
|
|
2693
|
+
* _The assertion does not match subclassed objects._
|
|
2463
2694
|
*
|
|
2464
2695
|
* var selection = { name: 'Chai', serve: 'with spices' };
|
|
2465
2696
|
* assert.isObject(selection, 'tea selection is an object');
|
|
@@ -2467,6 +2698,7 @@ module.exports = function (chai, util) {
|
|
|
2467
2698
|
* @name isObject
|
|
2468
2699
|
* @param {Mixed} value
|
|
2469
2700
|
* @param {String} message
|
|
2701
|
+
* @namespace Assert
|
|
2470
2702
|
* @api public
|
|
2471
2703
|
*/
|
|
2472
2704
|
|
|
@@ -2477,7 +2709,7 @@ module.exports = function (chai, util) {
|
|
|
2477
2709
|
/**
|
|
2478
2710
|
* ### .isNotObject(value, [message])
|
|
2479
2711
|
*
|
|
2480
|
-
* Asserts that `value` is _not_ an object.
|
|
2712
|
+
* Asserts that `value` is _not_ an object of type 'Object' (as revealed by `Object.prototype.toString`).
|
|
2481
2713
|
*
|
|
2482
2714
|
* var selection = 'chai'
|
|
2483
2715
|
* assert.isNotObject(selection, 'tea selection is not an object');
|
|
@@ -2486,6 +2718,7 @@ module.exports = function (chai, util) {
|
|
|
2486
2718
|
* @name isNotObject
|
|
2487
2719
|
* @param {Mixed} value
|
|
2488
2720
|
* @param {String} message
|
|
2721
|
+
* @namespace Assert
|
|
2489
2722
|
* @api public
|
|
2490
2723
|
*/
|
|
2491
2724
|
|
|
@@ -2504,6 +2737,7 @@ module.exports = function (chai, util) {
|
|
|
2504
2737
|
* @name isArray
|
|
2505
2738
|
* @param {Mixed} value
|
|
2506
2739
|
* @param {String} message
|
|
2740
|
+
* @namespace Assert
|
|
2507
2741
|
* @api public
|
|
2508
2742
|
*/
|
|
2509
2743
|
|
|
@@ -2522,6 +2756,7 @@ module.exports = function (chai, util) {
|
|
|
2522
2756
|
* @name isNotArray
|
|
2523
2757
|
* @param {Mixed} value
|
|
2524
2758
|
* @param {String} message
|
|
2759
|
+
* @namespace Assert
|
|
2525
2760
|
* @api public
|
|
2526
2761
|
*/
|
|
2527
2762
|
|
|
@@ -2540,6 +2775,7 @@ module.exports = function (chai, util) {
|
|
|
2540
2775
|
* @name isString
|
|
2541
2776
|
* @param {Mixed} value
|
|
2542
2777
|
* @param {String} message
|
|
2778
|
+
* @namespace Assert
|
|
2543
2779
|
* @api public
|
|
2544
2780
|
*/
|
|
2545
2781
|
|
|
@@ -2558,6 +2794,7 @@ module.exports = function (chai, util) {
|
|
|
2558
2794
|
* @name isNotString
|
|
2559
2795
|
* @param {Mixed} value
|
|
2560
2796
|
* @param {String} message
|
|
2797
|
+
* @namespace Assert
|
|
2561
2798
|
* @api public
|
|
2562
2799
|
*/
|
|
2563
2800
|
|
|
@@ -2576,6 +2813,7 @@ module.exports = function (chai, util) {
|
|
|
2576
2813
|
* @name isNumber
|
|
2577
2814
|
* @param {Number} value
|
|
2578
2815
|
* @param {String} message
|
|
2816
|
+
* @namespace Assert
|
|
2579
2817
|
* @api public
|
|
2580
2818
|
*/
|
|
2581
2819
|
|
|
@@ -2594,6 +2832,7 @@ module.exports = function (chai, util) {
|
|
|
2594
2832
|
* @name isNotNumber
|
|
2595
2833
|
* @param {Mixed} value
|
|
2596
2834
|
* @param {String} message
|
|
2835
|
+
* @namespace Assert
|
|
2597
2836
|
* @api public
|
|
2598
2837
|
*/
|
|
2599
2838
|
|
|
@@ -2615,6 +2854,7 @@ module.exports = function (chai, util) {
|
|
|
2615
2854
|
* @name isBoolean
|
|
2616
2855
|
* @param {Mixed} value
|
|
2617
2856
|
* @param {String} message
|
|
2857
|
+
* @namespace Assert
|
|
2618
2858
|
* @api public
|
|
2619
2859
|
*/
|
|
2620
2860
|
|
|
@@ -2636,6 +2876,7 @@ module.exports = function (chai, util) {
|
|
|
2636
2876
|
* @name isNotBoolean
|
|
2637
2877
|
* @param {Mixed} value
|
|
2638
2878
|
* @param {String} message
|
|
2879
|
+
* @namespace Assert
|
|
2639
2880
|
* @api public
|
|
2640
2881
|
*/
|
|
2641
2882
|
|
|
@@ -2660,6 +2901,7 @@ module.exports = function (chai, util) {
|
|
|
2660
2901
|
* @param {Mixed} value
|
|
2661
2902
|
* @param {String} name
|
|
2662
2903
|
* @param {String} message
|
|
2904
|
+
* @namespace Assert
|
|
2663
2905
|
* @api public
|
|
2664
2906
|
*/
|
|
2665
2907
|
|
|
@@ -2679,6 +2921,7 @@ module.exports = function (chai, util) {
|
|
|
2679
2921
|
* @param {Mixed} value
|
|
2680
2922
|
* @param {String} typeof name
|
|
2681
2923
|
* @param {String} message
|
|
2924
|
+
* @namespace Assert
|
|
2682
2925
|
* @api public
|
|
2683
2926
|
*/
|
|
2684
2927
|
|
|
@@ -2700,6 +2943,7 @@ module.exports = function (chai, util) {
|
|
|
2700
2943
|
* @param {Object} object
|
|
2701
2944
|
* @param {Constructor} constructor
|
|
2702
2945
|
* @param {String} message
|
|
2946
|
+
* @namespace Assert
|
|
2703
2947
|
* @api public
|
|
2704
2948
|
*/
|
|
2705
2949
|
|
|
@@ -2721,6 +2965,7 @@ module.exports = function (chai, util) {
|
|
|
2721
2965
|
* @param {Object} object
|
|
2722
2966
|
* @param {Constructor} constructor
|
|
2723
2967
|
* @param {String} message
|
|
2968
|
+
* @namespace Assert
|
|
2724
2969
|
* @api public
|
|
2725
2970
|
*/
|
|
2726
2971
|
|
|
@@ -2741,6 +2986,7 @@ module.exports = function (chai, util) {
|
|
|
2741
2986
|
* @param {Array|String} haystack
|
|
2742
2987
|
* @param {Mixed} needle
|
|
2743
2988
|
* @param {String} message
|
|
2989
|
+
* @namespace Assert
|
|
2744
2990
|
* @api public
|
|
2745
2991
|
*/
|
|
2746
2992
|
|
|
@@ -2761,6 +3007,7 @@ module.exports = function (chai, util) {
|
|
|
2761
3007
|
* @param {Array|String} haystack
|
|
2762
3008
|
* @param {Mixed} needle
|
|
2763
3009
|
* @param {String} message
|
|
3010
|
+
* @namespace Assert
|
|
2764
3011
|
* @api public
|
|
2765
3012
|
*/
|
|
2766
3013
|
|
|
@@ -2779,6 +3026,7 @@ module.exports = function (chai, util) {
|
|
|
2779
3026
|
* @param {Mixed} value
|
|
2780
3027
|
* @param {RegExp} regexp
|
|
2781
3028
|
* @param {String} message
|
|
3029
|
+
* @namespace Assert
|
|
2782
3030
|
* @api public
|
|
2783
3031
|
*/
|
|
2784
3032
|
|
|
@@ -2797,6 +3045,7 @@ module.exports = function (chai, util) {
|
|
|
2797
3045
|
* @param {Mixed} value
|
|
2798
3046
|
* @param {RegExp} regexp
|
|
2799
3047
|
* @param {String} message
|
|
3048
|
+
* @namespace Assert
|
|
2800
3049
|
* @api public
|
|
2801
3050
|
*/
|
|
2802
3051
|
|
|
@@ -2815,6 +3064,7 @@ module.exports = function (chai, util) {
|
|
|
2815
3064
|
* @param {Object} object
|
|
2816
3065
|
* @param {String} property
|
|
2817
3066
|
* @param {String} message
|
|
3067
|
+
* @namespace Assert
|
|
2818
3068
|
* @api public
|
|
2819
3069
|
*/
|
|
2820
3070
|
|
|
@@ -2833,6 +3083,7 @@ module.exports = function (chai, util) {
|
|
|
2833
3083
|
* @param {Object} object
|
|
2834
3084
|
* @param {String} property
|
|
2835
3085
|
* @param {String} message
|
|
3086
|
+
* @namespace Assert
|
|
2836
3087
|
* @api public
|
|
2837
3088
|
*/
|
|
2838
3089
|
|
|
@@ -2852,6 +3103,7 @@ module.exports = function (chai, util) {
|
|
|
2852
3103
|
* @param {Object} object
|
|
2853
3104
|
* @param {String} property
|
|
2854
3105
|
* @param {String} message
|
|
3106
|
+
* @namespace Assert
|
|
2855
3107
|
* @api public
|
|
2856
3108
|
*/
|
|
2857
3109
|
|
|
@@ -2871,6 +3123,7 @@ module.exports = function (chai, util) {
|
|
|
2871
3123
|
* @param {Object} object
|
|
2872
3124
|
* @param {String} property
|
|
2873
3125
|
* @param {String} message
|
|
3126
|
+
* @namespace Assert
|
|
2874
3127
|
* @api public
|
|
2875
3128
|
*/
|
|
2876
3129
|
|
|
@@ -2891,6 +3144,7 @@ module.exports = function (chai, util) {
|
|
|
2891
3144
|
* @param {String} property
|
|
2892
3145
|
* @param {Mixed} value
|
|
2893
3146
|
* @param {String} message
|
|
3147
|
+
* @namespace Assert
|
|
2894
3148
|
* @api public
|
|
2895
3149
|
*/
|
|
2896
3150
|
|
|
@@ -2911,6 +3165,7 @@ module.exports = function (chai, util) {
|
|
|
2911
3165
|
* @param {String} property
|
|
2912
3166
|
* @param {Mixed} value
|
|
2913
3167
|
* @param {String} message
|
|
3168
|
+
* @namespace Assert
|
|
2914
3169
|
* @api public
|
|
2915
3170
|
*/
|
|
2916
3171
|
|
|
@@ -2932,6 +3187,7 @@ module.exports = function (chai, util) {
|
|
|
2932
3187
|
* @param {String} property
|
|
2933
3188
|
* @param {Mixed} value
|
|
2934
3189
|
* @param {String} message
|
|
3190
|
+
* @namespace Assert
|
|
2935
3191
|
* @api public
|
|
2936
3192
|
*/
|
|
2937
3193
|
|
|
@@ -2953,6 +3209,7 @@ module.exports = function (chai, util) {
|
|
|
2953
3209
|
* @param {String} property
|
|
2954
3210
|
* @param {Mixed} value
|
|
2955
3211
|
* @param {String} message
|
|
3212
|
+
* @namespace Assert
|
|
2956
3213
|
* @api public
|
|
2957
3214
|
*/
|
|
2958
3215
|
|
|
@@ -2966,12 +3223,13 @@ module.exports = function (chai, util) {
|
|
|
2966
3223
|
* Asserts that `object` has a `length` property with the expected value.
|
|
2967
3224
|
*
|
|
2968
3225
|
* assert.lengthOf([1,2,3], 3, 'array has length of 3');
|
|
2969
|
-
* assert.lengthOf('foobar',
|
|
3226
|
+
* assert.lengthOf('foobar', 6, 'string has length of 6');
|
|
2970
3227
|
*
|
|
2971
3228
|
* @name lengthOf
|
|
2972
3229
|
* @param {Mixed} object
|
|
2973
3230
|
* @param {Number} length
|
|
2974
3231
|
* @param {String} message
|
|
3232
|
+
* @namespace Assert
|
|
2975
3233
|
* @api public
|
|
2976
3234
|
*/
|
|
2977
3235
|
|
|
@@ -3000,6 +3258,7 @@ module.exports = function (chai, util) {
|
|
|
3000
3258
|
* @param {RegExp} regexp
|
|
3001
3259
|
* @param {String} message
|
|
3002
3260
|
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
|
3261
|
+
* @namespace Assert
|
|
3003
3262
|
* @api public
|
|
3004
3263
|
*/
|
|
3005
3264
|
|
|
@@ -3028,6 +3287,7 @@ module.exports = function (chai, util) {
|
|
|
3028
3287
|
* @param {RegExp} regexp
|
|
3029
3288
|
* @param {String} message
|
|
3030
3289
|
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
|
3290
|
+
* @namespace Assert
|
|
3031
3291
|
* @api public
|
|
3032
3292
|
*/
|
|
3033
3293
|
|
|
@@ -3053,6 +3313,7 @@ module.exports = function (chai, util) {
|
|
|
3053
3313
|
* @param {String} operator
|
|
3054
3314
|
* @param {Mixed} val2
|
|
3055
3315
|
* @param {String} message
|
|
3316
|
+
* @namespace Assert
|
|
3056
3317
|
* @api public
|
|
3057
3318
|
*/
|
|
3058
3319
|
|
|
@@ -3105,6 +3366,7 @@ module.exports = function (chai, util) {
|
|
|
3105
3366
|
* @param {Number} expected
|
|
3106
3367
|
* @param {Number} delta
|
|
3107
3368
|
* @param {String} message
|
|
3369
|
+
* @namespace Assert
|
|
3108
3370
|
* @api public
|
|
3109
3371
|
*/
|
|
3110
3372
|
|
|
@@ -3112,6 +3374,26 @@ module.exports = function (chai, util) {
|
|
|
3112
3374
|
new Assertion(act, msg).to.be.closeTo(exp, delta);
|
|
3113
3375
|
};
|
|
3114
3376
|
|
|
3377
|
+
/**
|
|
3378
|
+
* ### .approximately(actual, expected, delta, [message])
|
|
3379
|
+
*
|
|
3380
|
+
* Asserts that the target is equal `expected`, to within a +/- `delta` range.
|
|
3381
|
+
*
|
|
3382
|
+
* assert.approximately(1.5, 1, 0.5, 'numbers are close');
|
|
3383
|
+
*
|
|
3384
|
+
* @name approximately
|
|
3385
|
+
* @param {Number} actual
|
|
3386
|
+
* @param {Number} expected
|
|
3387
|
+
* @param {Number} delta
|
|
3388
|
+
* @param {String} message
|
|
3389
|
+
* @namespace Assert
|
|
3390
|
+
* @api public
|
|
3391
|
+
*/
|
|
3392
|
+
|
|
3393
|
+
assert.approximately = function (act, exp, delta, msg) {
|
|
3394
|
+
new Assertion(act, msg).to.be.approximately(exp, delta);
|
|
3395
|
+
};
|
|
3396
|
+
|
|
3115
3397
|
/**
|
|
3116
3398
|
* ### .sameMembers(set1, set2, [message])
|
|
3117
3399
|
*
|
|
@@ -3124,6 +3406,7 @@ module.exports = function (chai, util) {
|
|
|
3124
3406
|
* @param {Array} set1
|
|
3125
3407
|
* @param {Array} set2
|
|
3126
3408
|
* @param {String} message
|
|
3409
|
+
* @namespace Assert
|
|
3127
3410
|
* @api public
|
|
3128
3411
|
*/
|
|
3129
3412
|
|
|
@@ -3143,6 +3426,7 @@ module.exports = function (chai, util) {
|
|
|
3143
3426
|
* @param {Array} set1
|
|
3144
3427
|
* @param {Array} set2
|
|
3145
3428
|
* @param {String} message
|
|
3429
|
+
* @namespace Assert
|
|
3146
3430
|
* @api public
|
|
3147
3431
|
*/
|
|
3148
3432
|
|
|
@@ -3162,6 +3446,7 @@ module.exports = function (chai, util) {
|
|
|
3162
3446
|
* @param {Array} superset
|
|
3163
3447
|
* @param {Array} subset
|
|
3164
3448
|
* @param {String} message
|
|
3449
|
+
* @namespace Assert
|
|
3165
3450
|
* @api public
|
|
3166
3451
|
*/
|
|
3167
3452
|
|
|
@@ -3169,6 +3454,46 @@ module.exports = function (chai, util) {
|
|
|
3169
3454
|
new Assertion(superset, msg).to.include.members(subset);
|
|
3170
3455
|
}
|
|
3171
3456
|
|
|
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
|
+
|
|
3478
|
+
/**
|
|
3479
|
+
* ### .oneOf(inList, list, [message])
|
|
3480
|
+
*
|
|
3481
|
+
* Asserts that non-object, non-array value `inList` appears in the flat array `list`.
|
|
3482
|
+
*
|
|
3483
|
+
* assert.oneOf(1, [ 2, 1 ], 'Not found in list');
|
|
3484
|
+
*
|
|
3485
|
+
* @name oneOf
|
|
3486
|
+
* @param {*} inList
|
|
3487
|
+
* @param {Array<*>} list
|
|
3488
|
+
* @param {String} message
|
|
3489
|
+
* @namespace Assert
|
|
3490
|
+
* @api public
|
|
3491
|
+
*/
|
|
3492
|
+
|
|
3493
|
+
assert.oneOf = function (inList, list, msg) {
|
|
3494
|
+
new Assertion(inList, msg).to.be.oneOf(list);
|
|
3495
|
+
}
|
|
3496
|
+
|
|
3172
3497
|
/**
|
|
3173
3498
|
* ### .changes(function, object, property)
|
|
3174
3499
|
*
|
|
@@ -3183,6 +3508,7 @@ module.exports = function (chai, util) {
|
|
|
3183
3508
|
* @param {Object} object
|
|
3184
3509
|
* @param {String} property name
|
|
3185
3510
|
* @param {String} message _optional_
|
|
3511
|
+
* @namespace Assert
|
|
3186
3512
|
* @api public
|
|
3187
3513
|
*/
|
|
3188
3514
|
|
|
@@ -3204,6 +3530,7 @@ module.exports = function (chai, util) {
|
|
|
3204
3530
|
* @param {Object} object
|
|
3205
3531
|
* @param {String} property name
|
|
3206
3532
|
* @param {String} message _optional_
|
|
3533
|
+
* @namespace Assert
|
|
3207
3534
|
* @api public
|
|
3208
3535
|
*/
|
|
3209
3536
|
|
|
@@ -3225,6 +3552,7 @@ module.exports = function (chai, util) {
|
|
|
3225
3552
|
* @param {Object} object
|
|
3226
3553
|
* @param {String} property name
|
|
3227
3554
|
* @param {String} message _optional_
|
|
3555
|
+
* @namespace Assert
|
|
3228
3556
|
* @api public
|
|
3229
3557
|
*/
|
|
3230
3558
|
|
|
@@ -3246,6 +3574,7 @@ module.exports = function (chai, util) {
|
|
|
3246
3574
|
* @param {Object} object
|
|
3247
3575
|
* @param {String} property name
|
|
3248
3576
|
* @param {String} message _optional_
|
|
3577
|
+
* @namespace Assert
|
|
3249
3578
|
* @api public
|
|
3250
3579
|
*/
|
|
3251
3580
|
|
|
@@ -3267,6 +3596,7 @@ module.exports = function (chai, util) {
|
|
|
3267
3596
|
* @param {Object} object
|
|
3268
3597
|
* @param {String} property name
|
|
3269
3598
|
* @param {String} message _optional_
|
|
3599
|
+
* @namespace Assert
|
|
3270
3600
|
* @api public
|
|
3271
3601
|
*/
|
|
3272
3602
|
|
|
@@ -3288,6 +3618,7 @@ module.exports = function (chai, util) {
|
|
|
3288
3618
|
* @param {Object} object
|
|
3289
3619
|
* @param {String} property name
|
|
3290
3620
|
* @param {String} message _optional_
|
|
3621
|
+
* @namespace Assert
|
|
3291
3622
|
* @api public
|
|
3292
3623
|
*/
|
|
3293
3624
|
|
|
@@ -3307,6 +3638,7 @@ module.exports = function (chai, util) {
|
|
|
3307
3638
|
*
|
|
3308
3639
|
* @name ifError
|
|
3309
3640
|
* @param {Object} object
|
|
3641
|
+
* @namespace Assert
|
|
3310
3642
|
* @api public
|
|
3311
3643
|
*/
|
|
3312
3644
|
|
|
@@ -3327,6 +3659,7 @@ module.exports = function (chai, util) {
|
|
|
3327
3659
|
* @alias extensible
|
|
3328
3660
|
* @param {Object} object
|
|
3329
3661
|
* @param {String} message _optional_
|
|
3662
|
+
* @namespace Assert
|
|
3330
3663
|
* @api public
|
|
3331
3664
|
*/
|
|
3332
3665
|
|
|
@@ -3351,6 +3684,7 @@ module.exports = function (chai, util) {
|
|
|
3351
3684
|
* @alias notExtensible
|
|
3352
3685
|
* @param {Object} object
|
|
3353
3686
|
* @param {String} message _optional_
|
|
3687
|
+
* @namespace Assert
|
|
3354
3688
|
* @api public
|
|
3355
3689
|
*/
|
|
3356
3690
|
|
|
@@ -3374,6 +3708,7 @@ module.exports = function (chai, util) {
|
|
|
3374
3708
|
* @alias sealed
|
|
3375
3709
|
* @param {Object} object
|
|
3376
3710
|
* @param {String} message _optional_
|
|
3711
|
+
* @namespace Assert
|
|
3377
3712
|
* @api public
|
|
3378
3713
|
*/
|
|
3379
3714
|
|
|
@@ -3392,6 +3727,7 @@ module.exports = function (chai, util) {
|
|
|
3392
3727
|
* @alias notSealed
|
|
3393
3728
|
* @param {Object} object
|
|
3394
3729
|
* @param {String} message _optional_
|
|
3730
|
+
* @namespace Assert
|
|
3395
3731
|
* @api public
|
|
3396
3732
|
*/
|
|
3397
3733
|
|
|
@@ -3412,6 +3748,7 @@ module.exports = function (chai, util) {
|
|
|
3412
3748
|
* @alias frozen
|
|
3413
3749
|
* @param {Object} object
|
|
3414
3750
|
* @param {String} message _optional_
|
|
3751
|
+
* @namespace Assert
|
|
3415
3752
|
* @api public
|
|
3416
3753
|
*/
|
|
3417
3754
|
|
|
@@ -3430,6 +3767,7 @@ module.exports = function (chai, util) {
|
|
|
3430
3767
|
* @alias notFrozen
|
|
3431
3768
|
* @param {Object} object
|
|
3432
3769
|
* @param {String} message _optional_
|
|
3770
|
+
* @namespace Assert
|
|
3433
3771
|
* @api public
|
|
3434
3772
|
*/
|
|
3435
3773
|
|
|
@@ -3479,6 +3817,7 @@ module.exports = function (chai, util) {
|
|
|
3479
3817
|
* @param {Mixed} expected
|
|
3480
3818
|
* @param {String} message
|
|
3481
3819
|
* @param {String} operator
|
|
3820
|
+
* @namespace Expect
|
|
3482
3821
|
* @api public
|
|
3483
3822
|
*/
|
|
3484
3823
|
|
|
@@ -3543,6 +3882,7 @@ module.exports = function (chai, util) {
|
|
|
3543
3882
|
* @param {Mixed} expected
|
|
3544
3883
|
* @param {String} message
|
|
3545
3884
|
* @param {String} operator
|
|
3885
|
+
* @namespace Should
|
|
3546
3886
|
* @api public
|
|
3547
3887
|
*/
|
|
3548
3888
|
|
|
@@ -3555,14 +3895,67 @@ module.exports = function (chai, util) {
|
|
|
3555
3895
|
}, should.fail);
|
|
3556
3896
|
};
|
|
3557
3897
|
|
|
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
|
+
|
|
3558
3913
|
should.equal = function (val1, val2, msg) {
|
|
3559
3914
|
new Assertion(val1, msg).to.equal(val2);
|
|
3560
3915
|
};
|
|
3561
3916
|
|
|
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
|
+
|
|
3562
3941
|
should.Throw = function (fn, errt, errs, msg) {
|
|
3563
3942
|
new Assertion(fn, msg).to.Throw(errt, errs);
|
|
3564
3943
|
};
|
|
3565
3944
|
|
|
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
|
+
|
|
3566
3959
|
should.exist = function (val, msg) {
|
|
3567
3960
|
new Assertion(val, msg).to.exist;
|
|
3568
3961
|
}
|
|
@@ -3570,14 +3963,63 @@ module.exports = function (chai, util) {
|
|
|
3570
3963
|
// negation
|
|
3571
3964
|
should.not = {}
|
|
3572
3965
|
|
|
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
|
+
|
|
3573
3981
|
should.not.equal = function (val1, val2, msg) {
|
|
3574
3982
|
new Assertion(val1, msg).to.not.equal(val2);
|
|
3575
3983
|
};
|
|
3576
3984
|
|
|
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
|
+
|
|
3577
4005
|
should.not.Throw = function (fn, errt, errs, msg) {
|
|
3578
4006
|
new Assertion(fn, msg).to.not.Throw(errt, errs);
|
|
3579
4007
|
};
|
|
3580
4008
|
|
|
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
|
+
|
|
3581
4023
|
should.not.exist = function (val, msg) {
|
|
3582
4024
|
new Assertion(val, msg).to.not.exist;
|
|
3583
4025
|
}
|
|
@@ -3647,6 +4089,7 @@ var call = Function.prototype.call,
|
|
|
3647
4089
|
* @param {String} name of method to add
|
|
3648
4090
|
* @param {Function} method function to be used for `name`, when called
|
|
3649
4091
|
* @param {Function} chainingBehavior function to be called every time the property is accessed
|
|
4092
|
+
* @namespace Utils
|
|
3650
4093
|
* @name addChainableMethod
|
|
3651
4094
|
* @api public
|
|
3652
4095
|
*/
|
|
@@ -3705,7 +4148,7 @@ module.exports = function (ctx, name, method, chainingBehavior) {
|
|
|
3705
4148
|
});
|
|
3706
4149
|
};
|
|
3707
4150
|
|
|
3708
|
-
},{"../config":4,"./flag":
|
|
4151
|
+
},{"../config":4,"./flag":13,"./transferFlags":29}],10:[function(require,module,exports){
|
|
3709
4152
|
/*!
|
|
3710
4153
|
* Chai - addMethod utility
|
|
3711
4154
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -3735,6 +4178,7 @@ var config = require('../config');
|
|
|
3735
4178
|
* @param {Object} ctx object to which the method is added
|
|
3736
4179
|
* @param {String} name of method to add
|
|
3737
4180
|
* @param {Function} method function to be used for name
|
|
4181
|
+
* @namespace Utils
|
|
3738
4182
|
* @name addMethod
|
|
3739
4183
|
* @api public
|
|
3740
4184
|
*/
|
|
@@ -3750,13 +4194,16 @@ module.exports = function (ctx, name, method) {
|
|
|
3750
4194
|
};
|
|
3751
4195
|
};
|
|
3752
4196
|
|
|
3753
|
-
},{"../config":4,"./flag":
|
|
4197
|
+
},{"../config":4,"./flag":13}],11:[function(require,module,exports){
|
|
3754
4198
|
/*!
|
|
3755
4199
|
* Chai - addProperty utility
|
|
3756
4200
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
3757
4201
|
* MIT Licensed
|
|
3758
4202
|
*/
|
|
3759
4203
|
|
|
4204
|
+
var config = require('../config');
|
|
4205
|
+
var flag = require('./flag');
|
|
4206
|
+
|
|
3760
4207
|
/**
|
|
3761
4208
|
* ### addProperty (ctx, name, getter)
|
|
3762
4209
|
*
|
|
@@ -3778,13 +4225,18 @@ module.exports = function (ctx, name, method) {
|
|
|
3778
4225
|
* @param {Object} ctx object to which the property is added
|
|
3779
4226
|
* @param {String} name of property to add
|
|
3780
4227
|
* @param {Function} getter function to be used for name
|
|
4228
|
+
* @namespace Utils
|
|
3781
4229
|
* @name addProperty
|
|
3782
4230
|
* @api public
|
|
3783
4231
|
*/
|
|
3784
4232
|
|
|
3785
4233
|
module.exports = function (ctx, name, getter) {
|
|
3786
4234
|
Object.defineProperty(ctx, name,
|
|
3787
|
-
{ get: function () {
|
|
4235
|
+
{ get: function addProperty() {
|
|
4236
|
+
var old_ssfi = flag(this, 'ssfi');
|
|
4237
|
+
if (old_ssfi && config.includeStack === false)
|
|
4238
|
+
flag(this, 'ssfi', addProperty);
|
|
4239
|
+
|
|
3788
4240
|
var result = getter.call(this);
|
|
3789
4241
|
return result === undefined ? this : result;
|
|
3790
4242
|
}
|
|
@@ -3792,7 +4244,51 @@ module.exports = function (ctx, name, getter) {
|
|
|
3792
4244
|
});
|
|
3793
4245
|
};
|
|
3794
4246
|
|
|
3795
|
-
},{}],12:[function(require,module,exports){
|
|
4247
|
+
},{"../config":4,"./flag":13}],12:[function(require,module,exports){
|
|
4248
|
+
/*!
|
|
4249
|
+
* Chai - expectTypes utility
|
|
4250
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
4251
|
+
* MIT Licensed
|
|
4252
|
+
*/
|
|
4253
|
+
|
|
4254
|
+
/**
|
|
4255
|
+
* ### expectTypes(obj, types)
|
|
4256
|
+
*
|
|
4257
|
+
* Ensures that the object being tested against is of a valid type.
|
|
4258
|
+
*
|
|
4259
|
+
* utils.expectTypes(this, ['array', 'object', 'string']);
|
|
4260
|
+
*
|
|
4261
|
+
* @param {Mixed} obj constructed Assertion
|
|
4262
|
+
* @param {Array} type A list of allowed types for this assertion
|
|
4263
|
+
* @namespace Utils
|
|
4264
|
+
* @name expectTypes
|
|
4265
|
+
* @api public
|
|
4266
|
+
*/
|
|
4267
|
+
|
|
4268
|
+
var AssertionError = require('assertion-error');
|
|
4269
|
+
var flag = require('./flag');
|
|
4270
|
+
var type = require('type-detect');
|
|
4271
|
+
|
|
4272
|
+
module.exports = function (obj, types) {
|
|
4273
|
+
var obj = flag(obj, 'object');
|
|
4274
|
+
types = types.map(function (t) { return t.toLowerCase(); });
|
|
4275
|
+
types.sort();
|
|
4276
|
+
|
|
4277
|
+
// Transforms ['lorem', 'ipsum'] into 'a lirum, or an ipsum'
|
|
4278
|
+
var str = types.map(function (t, index) {
|
|
4279
|
+
var art = ~[ 'a', 'e', 'i', 'o', 'u' ].indexOf(t.charAt(0)) ? 'an' : 'a';
|
|
4280
|
+
var or = types.length > 1 && index === types.length - 1 ? 'or ' : '';
|
|
4281
|
+
return or + art + ' ' + t;
|
|
4282
|
+
}).join(', ');
|
|
4283
|
+
|
|
4284
|
+
if (!types.some(function (expected) { return type(obj) === expected; })) {
|
|
4285
|
+
throw new AssertionError(
|
|
4286
|
+
'object tested must be ' + str + ', but ' + type(obj) + ' given'
|
|
4287
|
+
);
|
|
4288
|
+
}
|
|
4289
|
+
};
|
|
4290
|
+
|
|
4291
|
+
},{"./flag":13,"assertion-error":30,"type-detect":35}],13:[function(require,module,exports){
|
|
3796
4292
|
/*!
|
|
3797
4293
|
* Chai - flag utility
|
|
3798
4294
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -3813,6 +4309,7 @@ module.exports = function (ctx, name, getter) {
|
|
|
3813
4309
|
* @param {Object} object constructed Assertion
|
|
3814
4310
|
* @param {String} key
|
|
3815
4311
|
* @param {Mixed} value (optional)
|
|
4312
|
+
* @namespace Utils
|
|
3816
4313
|
* @name flag
|
|
3817
4314
|
* @api private
|
|
3818
4315
|
*/
|
|
@@ -3826,7 +4323,7 @@ module.exports = function (obj, key, value) {
|
|
|
3826
4323
|
}
|
|
3827
4324
|
};
|
|
3828
4325
|
|
|
3829
|
-
},{}],
|
|
4326
|
+
},{}],14:[function(require,module,exports){
|
|
3830
4327
|
/*!
|
|
3831
4328
|
* Chai - getActual utility
|
|
3832
4329
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -3840,13 +4337,15 @@ module.exports = function (obj, key, value) {
|
|
|
3840
4337
|
*
|
|
3841
4338
|
* @param {Object} object (constructed Assertion)
|
|
3842
4339
|
* @param {Arguments} chai.Assertion.prototype.assert arguments
|
|
4340
|
+
* @namespace Utils
|
|
4341
|
+
* @name getActual
|
|
3843
4342
|
*/
|
|
3844
4343
|
|
|
3845
4344
|
module.exports = function (obj, args) {
|
|
3846
4345
|
return args.length > 4 ? args[4] : obj._obj;
|
|
3847
4346
|
};
|
|
3848
4347
|
|
|
3849
|
-
},{}],
|
|
4348
|
+
},{}],15:[function(require,module,exports){
|
|
3850
4349
|
/*!
|
|
3851
4350
|
* Chai - getEnumerableProperties utility
|
|
3852
4351
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -3861,6 +4360,7 @@ module.exports = function (obj, args) {
|
|
|
3861
4360
|
*
|
|
3862
4361
|
* @param {Object} object
|
|
3863
4362
|
* @returns {Array}
|
|
4363
|
+
* @namespace Utils
|
|
3864
4364
|
* @name getEnumerableProperties
|
|
3865
4365
|
* @api public
|
|
3866
4366
|
*/
|
|
@@ -3873,7 +4373,7 @@ module.exports = function getEnumerableProperties(object) {
|
|
|
3873
4373
|
return result;
|
|
3874
4374
|
};
|
|
3875
4375
|
|
|
3876
|
-
},{}],
|
|
4376
|
+
},{}],16:[function(require,module,exports){
|
|
3877
4377
|
/*!
|
|
3878
4378
|
* Chai - message composition utility
|
|
3879
4379
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -3903,6 +4403,7 @@ var flag = require('./flag')
|
|
|
3903
4403
|
*
|
|
3904
4404
|
* @param {Object} object (constructed Assertion)
|
|
3905
4405
|
* @param {Arguments} chai.Assertion.prototype.assert arguments
|
|
4406
|
+
* @namespace Utils
|
|
3906
4407
|
* @name getMessage
|
|
3907
4408
|
* @api public
|
|
3908
4409
|
*/
|
|
@@ -3918,14 +4419,14 @@ module.exports = function (obj, args) {
|
|
|
3918
4419
|
if(typeof msg === "function") msg = msg();
|
|
3919
4420
|
msg = msg || '';
|
|
3920
4421
|
msg = msg
|
|
3921
|
-
.replace(
|
|
3922
|
-
.replace(
|
|
3923
|
-
.replace(
|
|
4422
|
+
.replace(/#\{this\}/g, function () { return objDisplay(val); })
|
|
4423
|
+
.replace(/#\{act\}/g, function () { return objDisplay(actual); })
|
|
4424
|
+
.replace(/#\{exp\}/g, function () { return objDisplay(expected); });
|
|
3924
4425
|
|
|
3925
4426
|
return flagMsg ? flagMsg + ': ' + msg : msg;
|
|
3926
4427
|
};
|
|
3927
4428
|
|
|
3928
|
-
},{"./flag":
|
|
4429
|
+
},{"./flag":13,"./getActual":14,"./inspect":23,"./objDisplay":24}],17:[function(require,module,exports){
|
|
3929
4430
|
/*!
|
|
3930
4431
|
* Chai - getName utility
|
|
3931
4432
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -3938,6 +4439,8 @@ module.exports = function (obj, args) {
|
|
|
3938
4439
|
* Gets the name of a function, in a cross-browser way.
|
|
3939
4440
|
*
|
|
3940
4441
|
* @param {Function} a function (usually a constructor)
|
|
4442
|
+
* @namespace Utils
|
|
4443
|
+
* @name getName
|
|
3941
4444
|
*/
|
|
3942
4445
|
|
|
3943
4446
|
module.exports = function (func) {
|
|
@@ -3947,7 +4450,7 @@ module.exports = function (func) {
|
|
|
3947
4450
|
return match && match[1] ? match[1] : "";
|
|
3948
4451
|
};
|
|
3949
4452
|
|
|
3950
|
-
},{}],
|
|
4453
|
+
},{}],18:[function(require,module,exports){
|
|
3951
4454
|
/*!
|
|
3952
4455
|
* Chai - getPathInfo utility
|
|
3953
4456
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -3973,6 +4476,7 @@ var hasProperty = require('./hasProperty');
|
|
|
3973
4476
|
* @param {String} path
|
|
3974
4477
|
* @param {Object} object
|
|
3975
4478
|
* @returns {Object} info
|
|
4479
|
+
* @namespace Utils
|
|
3976
4480
|
* @name getPathInfo
|
|
3977
4481
|
* @api public
|
|
3978
4482
|
*/
|
|
@@ -4059,7 +4563,7 @@ function _getPathValue (parsed, obj, index) {
|
|
|
4059
4563
|
return res;
|
|
4060
4564
|
}
|
|
4061
4565
|
|
|
4062
|
-
},{"./hasProperty":
|
|
4566
|
+
},{"./hasProperty":21}],19:[function(require,module,exports){
|
|
4063
4567
|
/*!
|
|
4064
4568
|
* Chai - getPathValue utility
|
|
4065
4569
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -4095,15 +4599,16 @@ var getPathInfo = require('./getPathInfo');
|
|
|
4095
4599
|
* @param {String} path
|
|
4096
4600
|
* @param {Object} object
|
|
4097
4601
|
* @returns {Object} value or `undefined`
|
|
4602
|
+
* @namespace Utils
|
|
4098
4603
|
* @name getPathValue
|
|
4099
4604
|
* @api public
|
|
4100
4605
|
*/
|
|
4101
4606
|
module.exports = function(path, obj) {
|
|
4102
4607
|
var info = getPathInfo(path, obj);
|
|
4103
4608
|
return info.value;
|
|
4104
|
-
};
|
|
4609
|
+
};
|
|
4105
4610
|
|
|
4106
|
-
},{"./getPathInfo":
|
|
4611
|
+
},{"./getPathInfo":18}],20:[function(require,module,exports){
|
|
4107
4612
|
/*!
|
|
4108
4613
|
* Chai - getProperties utility
|
|
4109
4614
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -4118,6 +4623,7 @@ module.exports = function(path, obj) {
|
|
|
4118
4623
|
*
|
|
4119
4624
|
* @param {Object} object
|
|
4120
4625
|
* @returns {Array}
|
|
4626
|
+
* @namespace Utils
|
|
4121
4627
|
* @name getProperties
|
|
4122
4628
|
* @api public
|
|
4123
4629
|
*/
|
|
@@ -4140,7 +4646,7 @@ module.exports = function getProperties(object) {
|
|
|
4140
4646
|
return result;
|
|
4141
4647
|
};
|
|
4142
4648
|
|
|
4143
|
-
},{}],
|
|
4649
|
+
},{}],21:[function(require,module,exports){
|
|
4144
4650
|
/*!
|
|
4145
4651
|
* Chai - hasProperty utility
|
|
4146
4652
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -4169,7 +4675,7 @@ var type = require('type-detect');
|
|
|
4169
4675
|
* hasProperty('str', obj); // true
|
|
4170
4676
|
* hasProperty('constructor', obj); // true
|
|
4171
4677
|
* hasProperty('bar', obj); // false
|
|
4172
|
-
*
|
|
4678
|
+
*
|
|
4173
4679
|
* hasProperty('length', obj.str); // true
|
|
4174
4680
|
* hasProperty(1, obj.str); // true
|
|
4175
4681
|
* hasProperty(5, obj.str); // false
|
|
@@ -4181,6 +4687,7 @@ var type = require('type-detect');
|
|
|
4181
4687
|
* @param {Objuect} object
|
|
4182
4688
|
* @param {String|Number} name
|
|
4183
4689
|
* @returns {Boolean} whether it exists
|
|
4690
|
+
* @namespace Utils
|
|
4184
4691
|
* @name getPathInfo
|
|
4185
4692
|
* @api public
|
|
4186
4693
|
*/
|
|
@@ -4205,7 +4712,7 @@ module.exports = function hasProperty(name, obj) {
|
|
|
4205
4712
|
return name in obj;
|
|
4206
4713
|
};
|
|
4207
4714
|
|
|
4208
|
-
},{"type-detect":
|
|
4715
|
+
},{"type-detect":35}],22:[function(require,module,exports){
|
|
4209
4716
|
/*!
|
|
4210
4717
|
* chai
|
|
4211
4718
|
* Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -4230,6 +4737,11 @@ exports.test = require('./test');
|
|
|
4230
4737
|
|
|
4231
4738
|
exports.type = require('type-detect');
|
|
4232
4739
|
|
|
4740
|
+
/*!
|
|
4741
|
+
* expectTypes utility
|
|
4742
|
+
*/
|
|
4743
|
+
exports.expectTypes = require('./expectTypes');
|
|
4744
|
+
|
|
4233
4745
|
/*!
|
|
4234
4746
|
* message utility
|
|
4235
4747
|
*/
|
|
@@ -4332,8 +4844,7 @@ exports.addChainableMethod = require('./addChainableMethod');
|
|
|
4332
4844
|
|
|
4333
4845
|
exports.overwriteChainableMethod = require('./overwriteChainableMethod');
|
|
4334
4846
|
|
|
4335
|
-
|
|
4336
|
-
},{"./addChainableMethod":9,"./addMethod":10,"./addProperty":11,"./flag":12,"./getActual":13,"./getMessage":15,"./getName":16,"./getPathInfo":17,"./getPathValue":18,"./hasProperty":20,"./inspect":22,"./objDisplay":23,"./overwriteChainableMethod":24,"./overwriteMethod":25,"./overwriteProperty":26,"./test":27,"./transferFlags":28,"deep-eql":30,"type-detect":34}],22:[function(require,module,exports){
|
|
4847
|
+
},{"./addChainableMethod":9,"./addMethod":10,"./addProperty":11,"./expectTypes":12,"./flag":13,"./getActual":14,"./getMessage":16,"./getName":17,"./getPathInfo":18,"./getPathValue":19,"./hasProperty":21,"./inspect":23,"./objDisplay":24,"./overwriteChainableMethod":25,"./overwriteMethod":26,"./overwriteProperty":27,"./test":28,"./transferFlags":29,"deep-eql":31,"type-detect":35}],23:[function(require,module,exports){
|
|
4337
4848
|
// This is (almost) directly from Node.js utils
|
|
4338
4849
|
// https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js
|
|
4339
4850
|
|
|
@@ -4353,6 +4864,8 @@ module.exports = inspect;
|
|
|
4353
4864
|
* @param {Number} depth Depth in which to descend in object. Default is 2.
|
|
4354
4865
|
* @param {Boolean} colors Flag to turn on ANSI escape codes to color the
|
|
4355
4866
|
* output. Default is false (no coloring).
|
|
4867
|
+
* @namespace Utils
|
|
4868
|
+
* @name inspect
|
|
4356
4869
|
*/
|
|
4357
4870
|
function inspect(obj, showHidden, depth, colors) {
|
|
4358
4871
|
var ctx = {
|
|
@@ -4668,7 +5181,7 @@ function objectToString(o) {
|
|
|
4668
5181
|
return Object.prototype.toString.call(o);
|
|
4669
5182
|
}
|
|
4670
5183
|
|
|
4671
|
-
},{"./getEnumerableProperties":
|
|
5184
|
+
},{"./getEnumerableProperties":15,"./getName":17,"./getProperties":20}],24:[function(require,module,exports){
|
|
4672
5185
|
/*!
|
|
4673
5186
|
* Chai - flag utility
|
|
4674
5187
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -4691,6 +5204,7 @@ var config = require('../config');
|
|
|
4691
5204
|
*
|
|
4692
5205
|
* @param {Mixed} javascript object to inspect
|
|
4693
5206
|
* @name objDisplay
|
|
5207
|
+
* @namespace Utils
|
|
4694
5208
|
* @api public
|
|
4695
5209
|
*/
|
|
4696
5210
|
|
|
@@ -4719,7 +5233,7 @@ module.exports = function (obj) {
|
|
|
4719
5233
|
}
|
|
4720
5234
|
};
|
|
4721
5235
|
|
|
4722
|
-
},{"../config":4,"./inspect":
|
|
5236
|
+
},{"../config":4,"./inspect":23}],25:[function(require,module,exports){
|
|
4723
5237
|
/*!
|
|
4724
5238
|
* Chai - overwriteChainableMethod utility
|
|
4725
5239
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -4754,6 +5268,7 @@ module.exports = function (obj) {
|
|
|
4754
5268
|
* @param {String} name of method / property to overwrite
|
|
4755
5269
|
* @param {Function} method function that returns a function to be used for name
|
|
4756
5270
|
* @param {Function} chainingBehavior function that returns a function to be used for property
|
|
5271
|
+
* @namespace Utils
|
|
4757
5272
|
* @name overwriteChainableMethod
|
|
4758
5273
|
* @api public
|
|
4759
5274
|
*/
|
|
@@ -4774,7 +5289,7 @@ module.exports = function (ctx, name, method, chainingBehavior) {
|
|
|
4774
5289
|
};
|
|
4775
5290
|
};
|
|
4776
5291
|
|
|
4777
|
-
},{}],
|
|
5292
|
+
},{}],26:[function(require,module,exports){
|
|
4778
5293
|
/*!
|
|
4779
5294
|
* Chai - overwriteMethod utility
|
|
4780
5295
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -4810,6 +5325,7 @@ module.exports = function (ctx, name, method, chainingBehavior) {
|
|
|
4810
5325
|
* @param {Object} ctx object whose method is to be overwritten
|
|
4811
5326
|
* @param {String} name of method to overwrite
|
|
4812
5327
|
* @param {Function} method function that returns a function to be used for name
|
|
5328
|
+
* @namespace Utils
|
|
4813
5329
|
* @name overwriteMethod
|
|
4814
5330
|
* @api public
|
|
4815
5331
|
*/
|
|
@@ -4827,7 +5343,7 @@ module.exports = function (ctx, name, method) {
|
|
|
4827
5343
|
}
|
|
4828
5344
|
};
|
|
4829
5345
|
|
|
4830
|
-
},{}],
|
|
5346
|
+
},{}],27:[function(require,module,exports){
|
|
4831
5347
|
/*!
|
|
4832
5348
|
* Chai - overwriteProperty utility
|
|
4833
5349
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -4863,6 +5379,7 @@ module.exports = function (ctx, name, method) {
|
|
|
4863
5379
|
* @param {Object} ctx object whose property is to be overwritten
|
|
4864
5380
|
* @param {String} name of property to overwrite
|
|
4865
5381
|
* @param {Function} getter function that returns a getter function to be used for name
|
|
5382
|
+
* @namespace Utils
|
|
4866
5383
|
* @name overwriteProperty
|
|
4867
5384
|
* @api public
|
|
4868
5385
|
*/
|
|
@@ -4883,7 +5400,7 @@ module.exports = function (ctx, name, getter) {
|
|
|
4883
5400
|
});
|
|
4884
5401
|
};
|
|
4885
5402
|
|
|
4886
|
-
},{}],
|
|
5403
|
+
},{}],28:[function(require,module,exports){
|
|
4887
5404
|
/*!
|
|
4888
5405
|
* Chai - test utility
|
|
4889
5406
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -4903,6 +5420,8 @@ var flag = require('./flag');
|
|
|
4903
5420
|
*
|
|
4904
5421
|
* @param {Object} object (constructed Assertion)
|
|
4905
5422
|
* @param {Arguments} chai.Assertion.prototype.assert arguments
|
|
5423
|
+
* @namespace Utils
|
|
5424
|
+
* @name test
|
|
4906
5425
|
*/
|
|
4907
5426
|
|
|
4908
5427
|
module.exports = function (obj, args) {
|
|
@@ -4911,7 +5430,7 @@ module.exports = function (obj, args) {
|
|
|
4911
5430
|
return negate ? !expr : expr;
|
|
4912
5431
|
};
|
|
4913
5432
|
|
|
4914
|
-
},{"./flag":
|
|
5433
|
+
},{"./flag":13}],29:[function(require,module,exports){
|
|
4915
5434
|
/*!
|
|
4916
5435
|
* Chai - transferFlags utility
|
|
4917
5436
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -4936,6 +5455,7 @@ module.exports = function (obj, args) {
|
|
|
4936
5455
|
* @param {Assertion} assertion the assertion to transfer the flags from
|
|
4937
5456
|
* @param {Object} object the object to transfer the flags to; usually a new assertion
|
|
4938
5457
|
* @param {Boolean} includeAll
|
|
5458
|
+
* @namespace Utils
|
|
4939
5459
|
* @name transferFlags
|
|
4940
5460
|
* @api private
|
|
4941
5461
|
*/
|
|
@@ -4957,7 +5477,7 @@ module.exports = function (assertion, object, includeAll) {
|
|
|
4957
5477
|
}
|
|
4958
5478
|
};
|
|
4959
5479
|
|
|
4960
|
-
},{}],
|
|
5480
|
+
},{}],30:[function(require,module,exports){
|
|
4961
5481
|
/*!
|
|
4962
5482
|
* assertion-error
|
|
4963
5483
|
* Copyright(c) 2013 Jake Luer <jake@qualiancy.com>
|
|
@@ -5071,10 +5591,10 @@ AssertionError.prototype.toJSON = function (stack) {
|
|
|
5071
5591
|
return props;
|
|
5072
5592
|
};
|
|
5073
5593
|
|
|
5074
|
-
},{}],
|
|
5594
|
+
},{}],31:[function(require,module,exports){
|
|
5075
5595
|
module.exports = require('./lib/eql');
|
|
5076
5596
|
|
|
5077
|
-
},{"./lib/eql":
|
|
5597
|
+
},{"./lib/eql":32}],32:[function(require,module,exports){
|
|
5078
5598
|
/*!
|
|
5079
5599
|
* deep-eql
|
|
5080
5600
|
* Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -5333,10 +5853,10 @@ function objectEqual(a, b, m) {
|
|
|
5333
5853
|
return true;
|
|
5334
5854
|
}
|
|
5335
5855
|
|
|
5336
|
-
},{"buffer":undefined,"type-detect":
|
|
5856
|
+
},{"buffer":undefined,"type-detect":33}],33:[function(require,module,exports){
|
|
5337
5857
|
module.exports = require('./lib/type');
|
|
5338
5858
|
|
|
5339
|
-
},{"./lib/type":
|
|
5859
|
+
},{"./lib/type":34}],34:[function(require,module,exports){
|
|
5340
5860
|
/*!
|
|
5341
5861
|
* type-detect
|
|
5342
5862
|
* Copyright(c) 2013 jake luer <jake@alogicalparadox.com>
|
|
@@ -5480,9 +6000,9 @@ Library.prototype.test = function (obj, type) {
|
|
|
5480
6000
|
}
|
|
5481
6001
|
};
|
|
5482
6002
|
|
|
5483
|
-
},{}],
|
|
5484
|
-
arguments[4][
|
|
5485
|
-
},{"./lib/type":
|
|
6003
|
+
},{}],35:[function(require,module,exports){
|
|
6004
|
+
arguments[4][33][0].apply(exports,arguments)
|
|
6005
|
+
},{"./lib/type":36,"dup":33}],36:[function(require,module,exports){
|
|
5486
6006
|
/*!
|
|
5487
6007
|
* type-detect
|
|
5488
6008
|
* Copyright(c) 2013 jake luer <jake@alogicalparadox.com>
|