chai 3.4.1 → 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 +1 -4
- package/README.md +2 -0
- package/chai.js +279 -10
- package/lib/chai/core/assertions.js +46 -1
- package/lib/chai/interface/assert.js +99 -3
- 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 +1 -0
- package/lib/chai/utils/expectTypes.js +1 -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/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
|
|
@@ -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
|
|
|
@@ -440,6 +445,7 @@ module.exports = function (chai, _) {
|
|
|
440
445
|
* @alias an
|
|
441
446
|
* @param {String} type
|
|
442
447
|
* @param {String} message _optional_
|
|
448
|
+
* @namespace BDD
|
|
443
449
|
* @api public
|
|
444
450
|
*/
|
|
445
451
|
|
|
@@ -477,6 +483,7 @@ module.exports = function (chai, _) {
|
|
|
477
483
|
* @alias contains
|
|
478
484
|
* @param {Object|String|Number} obj
|
|
479
485
|
* @param {String} message _optional_
|
|
486
|
+
* @namespace BDD
|
|
480
487
|
* @api public
|
|
481
488
|
*/
|
|
482
489
|
|
|
@@ -532,6 +539,7 @@ module.exports = function (chai, _) {
|
|
|
532
539
|
* expect(null).to.not.be.ok;
|
|
533
540
|
*
|
|
534
541
|
* @name ok
|
|
542
|
+
* @namespace BDD
|
|
535
543
|
* @api public
|
|
536
544
|
*/
|
|
537
545
|
|
|
@@ -551,6 +559,7 @@ module.exports = function (chai, _) {
|
|
|
551
559
|
* expect(1).to.not.be.true;
|
|
552
560
|
*
|
|
553
561
|
* @name true
|
|
562
|
+
* @namespace BDD
|
|
554
563
|
* @api public
|
|
555
564
|
*/
|
|
556
565
|
|
|
@@ -572,6 +581,7 @@ module.exports = function (chai, _) {
|
|
|
572
581
|
* expect(0).to.not.be.false;
|
|
573
582
|
*
|
|
574
583
|
* @name false
|
|
584
|
+
* @namespace BDD
|
|
575
585
|
* @api public
|
|
576
586
|
*/
|
|
577
587
|
|
|
@@ -593,6 +603,7 @@ module.exports = function (chai, _) {
|
|
|
593
603
|
* expect(undefined).to.not.be.null;
|
|
594
604
|
*
|
|
595
605
|
* @name null
|
|
606
|
+
* @namespace BDD
|
|
596
607
|
* @api public
|
|
597
608
|
*/
|
|
598
609
|
|
|
@@ -613,6 +624,7 @@ module.exports = function (chai, _) {
|
|
|
613
624
|
* expect(null).to.not.be.undefined;
|
|
614
625
|
*
|
|
615
626
|
* @name undefined
|
|
627
|
+
* @namespace BDD
|
|
616
628
|
* @api public
|
|
617
629
|
*/
|
|
618
630
|
|
|
@@ -632,6 +644,7 @@ module.exports = function (chai, _) {
|
|
|
632
644
|
* expect(4).not.to.be.NaN;
|
|
633
645
|
*
|
|
634
646
|
* @name NaN
|
|
647
|
+
* @namespace BDD
|
|
635
648
|
* @api public
|
|
636
649
|
*/
|
|
637
650
|
|
|
@@ -657,6 +670,7 @@ module.exports = function (chai, _) {
|
|
|
657
670
|
* expect(baz).to.not.exist;
|
|
658
671
|
*
|
|
659
672
|
* @name exist
|
|
673
|
+
* @namespace BDD
|
|
660
674
|
* @api public
|
|
661
675
|
*/
|
|
662
676
|
|
|
@@ -681,6 +695,7 @@ module.exports = function (chai, _) {
|
|
|
681
695
|
* expect({}).to.be.empty;
|
|
682
696
|
*
|
|
683
697
|
* @name empty
|
|
698
|
+
* @namespace BDD
|
|
684
699
|
* @api public
|
|
685
700
|
*/
|
|
686
701
|
|
|
@@ -712,6 +727,7 @@ module.exports = function (chai, _) {
|
|
|
712
727
|
*
|
|
713
728
|
* @name arguments
|
|
714
729
|
* @alias Arguments
|
|
730
|
+
* @namespace BDD
|
|
715
731
|
* @api public
|
|
716
732
|
*/
|
|
717
733
|
|
|
@@ -747,6 +763,7 @@ module.exports = function (chai, _) {
|
|
|
747
763
|
* @alias deep.equal
|
|
748
764
|
* @param {Mixed} value
|
|
749
765
|
* @param {String} message _optional_
|
|
766
|
+
* @namespace BDD
|
|
750
767
|
* @api public
|
|
751
768
|
*/
|
|
752
769
|
|
|
@@ -783,6 +800,7 @@ module.exports = function (chai, _) {
|
|
|
783
800
|
* @alias eqls
|
|
784
801
|
* @param {Mixed} value
|
|
785
802
|
* @param {String} message _optional_
|
|
803
|
+
* @namespace BDD
|
|
786
804
|
* @api public
|
|
787
805
|
*/
|
|
788
806
|
|
|
@@ -821,6 +839,7 @@ module.exports = function (chai, _) {
|
|
|
821
839
|
* @alias greaterThan
|
|
822
840
|
* @param {Number} value
|
|
823
841
|
* @param {String} message _optional_
|
|
842
|
+
* @namespace BDD
|
|
824
843
|
* @api public
|
|
825
844
|
*/
|
|
826
845
|
|
|
@@ -869,6 +888,7 @@ module.exports = function (chai, _) {
|
|
|
869
888
|
* @alias gte
|
|
870
889
|
* @param {Number} value
|
|
871
890
|
* @param {String} message _optional_
|
|
891
|
+
* @namespace BDD
|
|
872
892
|
* @api public
|
|
873
893
|
*/
|
|
874
894
|
|
|
@@ -917,6 +937,7 @@ module.exports = function (chai, _) {
|
|
|
917
937
|
* @alias lessThan
|
|
918
938
|
* @param {Number} value
|
|
919
939
|
* @param {String} message _optional_
|
|
940
|
+
* @namespace BDD
|
|
920
941
|
* @api public
|
|
921
942
|
*/
|
|
922
943
|
|
|
@@ -965,6 +986,7 @@ module.exports = function (chai, _) {
|
|
|
965
986
|
* @alias lte
|
|
966
987
|
* @param {Number} value
|
|
967
988
|
* @param {String} message _optional_
|
|
989
|
+
* @namespace BDD
|
|
968
990
|
* @api public
|
|
969
991
|
*/
|
|
970
992
|
|
|
@@ -1012,6 +1034,7 @@ module.exports = function (chai, _) {
|
|
|
1012
1034
|
* @param {Number} start lowerbound inclusive
|
|
1013
1035
|
* @param {Number} finish upperbound inclusive
|
|
1014
1036
|
* @param {String} message _optional_
|
|
1037
|
+
* @namespace BDD
|
|
1015
1038
|
* @api public
|
|
1016
1039
|
*/
|
|
1017
1040
|
|
|
@@ -1051,6 +1074,7 @@ module.exports = function (chai, _) {
|
|
|
1051
1074
|
* @param {Constructor} constructor
|
|
1052
1075
|
* @param {String} message _optional_
|
|
1053
1076
|
* @alias instanceOf
|
|
1077
|
+
* @namespace BDD
|
|
1054
1078
|
* @api public
|
|
1055
1079
|
*/
|
|
1056
1080
|
|
|
@@ -1135,6 +1159,7 @@ module.exports = function (chai, _) {
|
|
|
1135
1159
|
* @param {Mixed} value (optional)
|
|
1136
1160
|
* @param {String} message _optional_
|
|
1137
1161
|
* @returns value of property for chaining
|
|
1162
|
+
* @namespace BDD
|
|
1138
1163
|
* @api public
|
|
1139
1164
|
*/
|
|
1140
1165
|
|
|
@@ -1190,6 +1215,7 @@ module.exports = function (chai, _) {
|
|
|
1190
1215
|
* @alias haveOwnProperty
|
|
1191
1216
|
* @param {String} name
|
|
1192
1217
|
* @param {String} message _optional_
|
|
1218
|
+
* @namespace BDD
|
|
1193
1219
|
* @api public
|
|
1194
1220
|
*/
|
|
1195
1221
|
|
|
@@ -1222,6 +1248,7 @@ module.exports = function (chai, _) {
|
|
|
1222
1248
|
* @param {String} name
|
|
1223
1249
|
* @param {Object} descriptor _optional_
|
|
1224
1250
|
* @param {String} message _optional_
|
|
1251
|
+
* @namespace BDD
|
|
1225
1252
|
* @api public
|
|
1226
1253
|
*/
|
|
1227
1254
|
|
|
@@ -1274,6 +1301,7 @@ module.exports = function (chai, _) {
|
|
|
1274
1301
|
* switched to use `lengthOf(value)` instead.
|
|
1275
1302
|
*
|
|
1276
1303
|
* @name length
|
|
1304
|
+
* @namespace BDD
|
|
1277
1305
|
* @api public
|
|
1278
1306
|
*/
|
|
1279
1307
|
|
|
@@ -1289,6 +1317,7 @@ module.exports = function (chai, _) {
|
|
|
1289
1317
|
* @name lengthOf
|
|
1290
1318
|
* @param {Number} length
|
|
1291
1319
|
* @param {String} message _optional_
|
|
1320
|
+
* @namespace BDD
|
|
1292
1321
|
* @api public
|
|
1293
1322
|
*/
|
|
1294
1323
|
|
|
@@ -1325,6 +1354,7 @@ module.exports = function (chai, _) {
|
|
|
1325
1354
|
* @alias matches
|
|
1326
1355
|
* @param {RegExp} RegularExpression
|
|
1327
1356
|
* @param {String} message _optional_
|
|
1357
|
+
* @namespace BDD
|
|
1328
1358
|
* @api public
|
|
1329
1359
|
*/
|
|
1330
1360
|
function assertMatch(re, msg) {
|
|
@@ -1350,6 +1380,7 @@ module.exports = function (chai, _) {
|
|
|
1350
1380
|
* @name string
|
|
1351
1381
|
* @param {String} string
|
|
1352
1382
|
* @param {String} message _optional_
|
|
1383
|
+
* @namespace BDD
|
|
1353
1384
|
* @api public
|
|
1354
1385
|
*/
|
|
1355
1386
|
|
|
@@ -1401,6 +1432,7 @@ module.exports = function (chai, _) {
|
|
|
1401
1432
|
* @name keys
|
|
1402
1433
|
* @alias key
|
|
1403
1434
|
* @param {...String|Array|Object} keys
|
|
1435
|
+
* @namespace BDD
|
|
1404
1436
|
* @api public
|
|
1405
1437
|
*/
|
|
1406
1438
|
|
|
@@ -1520,6 +1552,7 @@ module.exports = function (chai, _) {
|
|
|
1520
1552
|
* @param {String} message _optional_
|
|
1521
1553
|
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
|
1522
1554
|
* @returns error for chaining (null if no error)
|
|
1555
|
+
* @namespace BDD
|
|
1523
1556
|
* @api public
|
|
1524
1557
|
*/
|
|
1525
1558
|
|
|
@@ -1663,6 +1696,7 @@ module.exports = function (chai, _) {
|
|
|
1663
1696
|
* @alias respondsTo
|
|
1664
1697
|
* @param {String} method
|
|
1665
1698
|
* @param {String} message _optional_
|
|
1699
|
+
* @namespace BDD
|
|
1666
1700
|
* @api public
|
|
1667
1701
|
*/
|
|
1668
1702
|
|
|
@@ -1697,6 +1731,7 @@ module.exports = function (chai, _) {
|
|
|
1697
1731
|
* expect(Foo).itself.not.to.respondTo('baz');
|
|
1698
1732
|
*
|
|
1699
1733
|
* @name itself
|
|
1734
|
+
* @namespace BDD
|
|
1700
1735
|
* @api public
|
|
1701
1736
|
*/
|
|
1702
1737
|
|
|
@@ -1715,6 +1750,7 @@ module.exports = function (chai, _) {
|
|
|
1715
1750
|
* @alias satisfies
|
|
1716
1751
|
* @param {Function} matcher
|
|
1717
1752
|
* @param {String} message _optional_
|
|
1753
|
+
* @namespace BDD
|
|
1718
1754
|
* @api public
|
|
1719
1755
|
*/
|
|
1720
1756
|
|
|
@@ -1746,6 +1782,7 @@ module.exports = function (chai, _) {
|
|
|
1746
1782
|
* @param {Number} expected
|
|
1747
1783
|
* @param {Number} delta
|
|
1748
1784
|
* @param {String} message _optional_
|
|
1785
|
+
* @namespace BDD
|
|
1749
1786
|
* @api public
|
|
1750
1787
|
*/
|
|
1751
1788
|
|
|
@@ -1797,6 +1834,7 @@ module.exports = function (chai, _) {
|
|
|
1797
1834
|
* @name members
|
|
1798
1835
|
* @param {Array} set
|
|
1799
1836
|
* @param {String} message _optional_
|
|
1837
|
+
* @namespace BDD
|
|
1800
1838
|
* @api public
|
|
1801
1839
|
*/
|
|
1802
1840
|
|
|
@@ -1846,6 +1884,7 @@ module.exports = function (chai, _) {
|
|
|
1846
1884
|
* @name oneOf
|
|
1847
1885
|
* @param {Array<*>} list
|
|
1848
1886
|
* @param {String} message _optional_
|
|
1887
|
+
* @namespace BDD
|
|
1849
1888
|
* @api public
|
|
1850
1889
|
*/
|
|
1851
1890
|
|
|
@@ -1875,7 +1914,7 @@ module.exports = function (chai, _) {
|
|
|
1875
1914
|
* var fn = function() { obj.val += 3 };
|
|
1876
1915
|
* var noChangeFn = function() { return 'foo' + 'bar'; }
|
|
1877
1916
|
* expect(fn).to.change(obj, 'val');
|
|
1878
|
-
* expect(
|
|
1917
|
+
* expect(noChangeFn).to.not.change(obj, 'val')
|
|
1879
1918
|
*
|
|
1880
1919
|
* @name change
|
|
1881
1920
|
* @alias changes
|
|
@@ -1883,6 +1922,7 @@ module.exports = function (chai, _) {
|
|
|
1883
1922
|
* @param {String} object
|
|
1884
1923
|
* @param {String} property name
|
|
1885
1924
|
* @param {String} message _optional_
|
|
1925
|
+
* @namespace BDD
|
|
1886
1926
|
* @api public
|
|
1887
1927
|
*/
|
|
1888
1928
|
|
|
@@ -1920,6 +1960,7 @@ module.exports = function (chai, _) {
|
|
|
1920
1960
|
* @param {String} object
|
|
1921
1961
|
* @param {String} property name
|
|
1922
1962
|
* @param {String} message _optional_
|
|
1963
|
+
* @namespace BDD
|
|
1923
1964
|
* @api public
|
|
1924
1965
|
*/
|
|
1925
1966
|
|
|
@@ -1957,6 +1998,7 @@ module.exports = function (chai, _) {
|
|
|
1957
1998
|
* @param {String} object
|
|
1958
1999
|
* @param {String} property name
|
|
1959
2000
|
* @param {String} message _optional_
|
|
2001
|
+
* @namespace BDD
|
|
1960
2002
|
* @api public
|
|
1961
2003
|
*/
|
|
1962
2004
|
|
|
@@ -1995,6 +2037,7 @@ module.exports = function (chai, _) {
|
|
|
1995
2037
|
* expect(frozenObject).to.not.be.extensible;
|
|
1996
2038
|
*
|
|
1997
2039
|
* @name extensible
|
|
2040
|
+
* @namespace BDD
|
|
1998
2041
|
* @api public
|
|
1999
2042
|
*/
|
|
2000
2043
|
|
|
@@ -2036,6 +2079,7 @@ module.exports = function (chai, _) {
|
|
|
2036
2079
|
* expect({}).to.not.be.sealed;
|
|
2037
2080
|
*
|
|
2038
2081
|
* @name sealed
|
|
2082
|
+
* @namespace BDD
|
|
2039
2083
|
* @api public
|
|
2040
2084
|
*/
|
|
2041
2085
|
|
|
@@ -2075,6 +2119,7 @@ module.exports = function (chai, _) {
|
|
|
2075
2119
|
* expect({}).to.not.be.frozen;
|
|
2076
2120
|
*
|
|
2077
2121
|
* @name frozen
|
|
2122
|
+
* @namespace BDD
|
|
2078
2123
|
* @api public
|
|
2079
2124
|
*/
|
|
2080
2125
|
|
|
@@ -2135,6 +2180,7 @@ module.exports = function (chai, util) {
|
|
|
2135
2180
|
* @param {Mixed} expression to test for truthiness
|
|
2136
2181
|
* @param {String} message to display on error
|
|
2137
2182
|
* @name assert
|
|
2183
|
+
* @namespace Assert
|
|
2138
2184
|
* @api public
|
|
2139
2185
|
*/
|
|
2140
2186
|
|
|
@@ -2157,6 +2203,7 @@ module.exports = function (chai, util) {
|
|
|
2157
2203
|
* @param {Mixed} expected
|
|
2158
2204
|
* @param {String} message
|
|
2159
2205
|
* @param {String} operator
|
|
2206
|
+
* @namespace Assert
|
|
2160
2207
|
* @api public
|
|
2161
2208
|
*/
|
|
2162
2209
|
|
|
@@ -2181,6 +2228,7 @@ module.exports = function (chai, util) {
|
|
|
2181
2228
|
* @alias ok
|
|
2182
2229
|
* @param {Mixed} object to test
|
|
2183
2230
|
* @param {String} message
|
|
2231
|
+
* @namespace Assert
|
|
2184
2232
|
* @api public
|
|
2185
2233
|
*/
|
|
2186
2234
|
|
|
@@ -2200,6 +2248,7 @@ module.exports = function (chai, util) {
|
|
|
2200
2248
|
* @alias notOk
|
|
2201
2249
|
* @param {Mixed} object to test
|
|
2202
2250
|
* @param {String} message
|
|
2251
|
+
* @namespace Assert
|
|
2203
2252
|
* @api public
|
|
2204
2253
|
*/
|
|
2205
2254
|
|
|
@@ -2218,6 +2267,7 @@ module.exports = function (chai, util) {
|
|
|
2218
2267
|
* @param {Mixed} actual
|
|
2219
2268
|
* @param {Mixed} expected
|
|
2220
2269
|
* @param {String} message
|
|
2270
|
+
* @namespace Assert
|
|
2221
2271
|
* @api public
|
|
2222
2272
|
*/
|
|
2223
2273
|
|
|
@@ -2244,6 +2294,7 @@ module.exports = function (chai, util) {
|
|
|
2244
2294
|
* @param {Mixed} actual
|
|
2245
2295
|
* @param {Mixed} expected
|
|
2246
2296
|
* @param {String} message
|
|
2297
|
+
* @namespace Assert
|
|
2247
2298
|
* @api public
|
|
2248
2299
|
*/
|
|
2249
2300
|
|
|
@@ -2270,6 +2321,7 @@ module.exports = function (chai, util) {
|
|
|
2270
2321
|
* @param {Mixed} actual
|
|
2271
2322
|
* @param {Mixed} expected
|
|
2272
2323
|
* @param {String} message
|
|
2324
|
+
* @namespace Assert
|
|
2273
2325
|
* @api public
|
|
2274
2326
|
*/
|
|
2275
2327
|
|
|
@@ -2288,6 +2340,7 @@ module.exports = function (chai, util) {
|
|
|
2288
2340
|
* @param {Mixed} actual
|
|
2289
2341
|
* @param {Mixed} expected
|
|
2290
2342
|
* @param {String} message
|
|
2343
|
+
* @namespace Assert
|
|
2291
2344
|
* @api public
|
|
2292
2345
|
*/
|
|
2293
2346
|
|
|
@@ -2306,6 +2359,7 @@ module.exports = function (chai, util) {
|
|
|
2306
2359
|
* @param {Mixed} actual
|
|
2307
2360
|
* @param {Mixed} expected
|
|
2308
2361
|
* @param {String} message
|
|
2362
|
+
* @namespace Assert
|
|
2309
2363
|
* @api public
|
|
2310
2364
|
*/
|
|
2311
2365
|
|
|
@@ -2324,6 +2378,7 @@ module.exports = function (chai, util) {
|
|
|
2324
2378
|
* @param {Mixed} actual
|
|
2325
2379
|
* @param {Mixed} expected
|
|
2326
2380
|
* @param {String} message
|
|
2381
|
+
* @namespace Assert
|
|
2327
2382
|
* @api public
|
|
2328
2383
|
*/
|
|
2329
2384
|
|
|
@@ -2342,6 +2397,7 @@ module.exports = function (chai, util) {
|
|
|
2342
2397
|
* @param {Mixed} valueToCheck
|
|
2343
2398
|
* @param {Mixed} valueToBeAbove
|
|
2344
2399
|
* @param {String} message
|
|
2400
|
+
* @namespace Assert
|
|
2345
2401
|
* @api public
|
|
2346
2402
|
*/
|
|
2347
2403
|
|
|
@@ -2361,6 +2417,7 @@ module.exports = function (chai, util) {
|
|
|
2361
2417
|
* @param {Mixed} valueToCheck
|
|
2362
2418
|
* @param {Mixed} valueToBeAtLeast
|
|
2363
2419
|
* @param {String} message
|
|
2420
|
+
* @namespace Assert
|
|
2364
2421
|
* @api public
|
|
2365
2422
|
*/
|
|
2366
2423
|
|
|
@@ -2379,6 +2436,7 @@ module.exports = function (chai, util) {
|
|
|
2379
2436
|
* @param {Mixed} valueToCheck
|
|
2380
2437
|
* @param {Mixed} valueToBeBelow
|
|
2381
2438
|
* @param {String} message
|
|
2439
|
+
* @namespace Assert
|
|
2382
2440
|
* @api public
|
|
2383
2441
|
*/
|
|
2384
2442
|
|
|
@@ -2398,6 +2456,7 @@ module.exports = function (chai, util) {
|
|
|
2398
2456
|
* @param {Mixed} valueToCheck
|
|
2399
2457
|
* @param {Mixed} valueToBeAtMost
|
|
2400
2458
|
* @param {String} message
|
|
2459
|
+
* @namespace Assert
|
|
2401
2460
|
* @api public
|
|
2402
2461
|
*/
|
|
2403
2462
|
|
|
@@ -2416,6 +2475,7 @@ module.exports = function (chai, util) {
|
|
|
2416
2475
|
* @name isTrue
|
|
2417
2476
|
* @param {Mixed} value
|
|
2418
2477
|
* @param {String} message
|
|
2478
|
+
* @namespace Assert
|
|
2419
2479
|
* @api public
|
|
2420
2480
|
*/
|
|
2421
2481
|
|
|
@@ -2434,6 +2494,7 @@ module.exports = function (chai, util) {
|
|
|
2434
2494
|
* @name isNotTrue
|
|
2435
2495
|
* @param {Mixed} value
|
|
2436
2496
|
* @param {String} message
|
|
2497
|
+
* @namespace Assert
|
|
2437
2498
|
* @api public
|
|
2438
2499
|
*/
|
|
2439
2500
|
|
|
@@ -2452,6 +2513,7 @@ module.exports = function (chai, util) {
|
|
|
2452
2513
|
* @name isFalse
|
|
2453
2514
|
* @param {Mixed} value
|
|
2454
2515
|
* @param {String} message
|
|
2516
|
+
* @namespace Assert
|
|
2455
2517
|
* @api public
|
|
2456
2518
|
*/
|
|
2457
2519
|
|
|
@@ -2470,6 +2532,7 @@ module.exports = function (chai, util) {
|
|
|
2470
2532
|
* @name isNotFalse
|
|
2471
2533
|
* @param {Mixed} value
|
|
2472
2534
|
* @param {String} message
|
|
2535
|
+
* @namespace Assert
|
|
2473
2536
|
* @api public
|
|
2474
2537
|
*/
|
|
2475
2538
|
|
|
@@ -2487,6 +2550,7 @@ module.exports = function (chai, util) {
|
|
|
2487
2550
|
* @name isNull
|
|
2488
2551
|
* @param {Mixed} value
|
|
2489
2552
|
* @param {String} message
|
|
2553
|
+
* @namespace Assert
|
|
2490
2554
|
* @api public
|
|
2491
2555
|
*/
|
|
2492
2556
|
|
|
@@ -2505,6 +2569,7 @@ module.exports = function (chai, util) {
|
|
|
2505
2569
|
* @name isNotNull
|
|
2506
2570
|
* @param {Mixed} value
|
|
2507
2571
|
* @param {String} message
|
|
2572
|
+
* @namespace Assert
|
|
2508
2573
|
* @api public
|
|
2509
2574
|
*/
|
|
2510
2575
|
|
|
@@ -2521,6 +2586,7 @@ module.exports = function (chai, util) {
|
|
|
2521
2586
|
* @name isNaN
|
|
2522
2587
|
* @param {Mixed} value
|
|
2523
2588
|
* @param {String} message
|
|
2589
|
+
* @namespace Assert
|
|
2524
2590
|
* @api public
|
|
2525
2591
|
*/
|
|
2526
2592
|
|
|
@@ -2537,6 +2603,7 @@ module.exports = function (chai, util) {
|
|
|
2537
2603
|
* @name isNotNaN
|
|
2538
2604
|
* @param {Mixed} value
|
|
2539
2605
|
* @param {String} message
|
|
2606
|
+
* @namespace Assert
|
|
2540
2607
|
* @api public
|
|
2541
2608
|
*/
|
|
2542
2609
|
assert.isNotNaN = function (val, msg) {
|
|
@@ -2554,6 +2621,7 @@ module.exports = function (chai, util) {
|
|
|
2554
2621
|
* @name isUndefined
|
|
2555
2622
|
* @param {Mixed} value
|
|
2556
2623
|
* @param {String} message
|
|
2624
|
+
* @namespace Assert
|
|
2557
2625
|
* @api public
|
|
2558
2626
|
*/
|
|
2559
2627
|
|
|
@@ -2572,6 +2640,7 @@ module.exports = function (chai, util) {
|
|
|
2572
2640
|
* @name isDefined
|
|
2573
2641
|
* @param {Mixed} value
|
|
2574
2642
|
* @param {String} message
|
|
2643
|
+
* @namespace Assert
|
|
2575
2644
|
* @api public
|
|
2576
2645
|
*/
|
|
2577
2646
|
|
|
@@ -2590,6 +2659,7 @@ module.exports = function (chai, util) {
|
|
|
2590
2659
|
* @name isFunction
|
|
2591
2660
|
* @param {Mixed} value
|
|
2592
2661
|
* @param {String} message
|
|
2662
|
+
* @namespace Assert
|
|
2593
2663
|
* @api public
|
|
2594
2664
|
*/
|
|
2595
2665
|
|
|
@@ -2608,6 +2678,7 @@ module.exports = function (chai, util) {
|
|
|
2608
2678
|
* @name isNotFunction
|
|
2609
2679
|
* @param {Mixed} value
|
|
2610
2680
|
* @param {String} message
|
|
2681
|
+
* @namespace Assert
|
|
2611
2682
|
* @api public
|
|
2612
2683
|
*/
|
|
2613
2684
|
|
|
@@ -2618,8 +2689,8 @@ module.exports = function (chai, util) {
|
|
|
2618
2689
|
/**
|
|
2619
2690
|
* ### .isObject(value, [message])
|
|
2620
2691
|
*
|
|
2621
|
-
* Asserts that `value` is an object (as revealed by
|
|
2622
|
-
*
|
|
2692
|
+
* Asserts that `value` is an object of type 'Object' (as revealed by `Object.prototype.toString`).
|
|
2693
|
+
* _The assertion does not match subclassed objects._
|
|
2623
2694
|
*
|
|
2624
2695
|
* var selection = { name: 'Chai', serve: 'with spices' };
|
|
2625
2696
|
* assert.isObject(selection, 'tea selection is an object');
|
|
@@ -2627,6 +2698,7 @@ module.exports = function (chai, util) {
|
|
|
2627
2698
|
* @name isObject
|
|
2628
2699
|
* @param {Mixed} value
|
|
2629
2700
|
* @param {String} message
|
|
2701
|
+
* @namespace Assert
|
|
2630
2702
|
* @api public
|
|
2631
2703
|
*/
|
|
2632
2704
|
|
|
@@ -2637,7 +2709,7 @@ module.exports = function (chai, util) {
|
|
|
2637
2709
|
/**
|
|
2638
2710
|
* ### .isNotObject(value, [message])
|
|
2639
2711
|
*
|
|
2640
|
-
* Asserts that `value` is _not_ an object.
|
|
2712
|
+
* Asserts that `value` is _not_ an object of type 'Object' (as revealed by `Object.prototype.toString`).
|
|
2641
2713
|
*
|
|
2642
2714
|
* var selection = 'chai'
|
|
2643
2715
|
* assert.isNotObject(selection, 'tea selection is not an object');
|
|
@@ -2646,6 +2718,7 @@ module.exports = function (chai, util) {
|
|
|
2646
2718
|
* @name isNotObject
|
|
2647
2719
|
* @param {Mixed} value
|
|
2648
2720
|
* @param {String} message
|
|
2721
|
+
* @namespace Assert
|
|
2649
2722
|
* @api public
|
|
2650
2723
|
*/
|
|
2651
2724
|
|
|
@@ -2664,6 +2737,7 @@ module.exports = function (chai, util) {
|
|
|
2664
2737
|
* @name isArray
|
|
2665
2738
|
* @param {Mixed} value
|
|
2666
2739
|
* @param {String} message
|
|
2740
|
+
* @namespace Assert
|
|
2667
2741
|
* @api public
|
|
2668
2742
|
*/
|
|
2669
2743
|
|
|
@@ -2682,6 +2756,7 @@ module.exports = function (chai, util) {
|
|
|
2682
2756
|
* @name isNotArray
|
|
2683
2757
|
* @param {Mixed} value
|
|
2684
2758
|
* @param {String} message
|
|
2759
|
+
* @namespace Assert
|
|
2685
2760
|
* @api public
|
|
2686
2761
|
*/
|
|
2687
2762
|
|
|
@@ -2700,6 +2775,7 @@ module.exports = function (chai, util) {
|
|
|
2700
2775
|
* @name isString
|
|
2701
2776
|
* @param {Mixed} value
|
|
2702
2777
|
* @param {String} message
|
|
2778
|
+
* @namespace Assert
|
|
2703
2779
|
* @api public
|
|
2704
2780
|
*/
|
|
2705
2781
|
|
|
@@ -2718,6 +2794,7 @@ module.exports = function (chai, util) {
|
|
|
2718
2794
|
* @name isNotString
|
|
2719
2795
|
* @param {Mixed} value
|
|
2720
2796
|
* @param {String} message
|
|
2797
|
+
* @namespace Assert
|
|
2721
2798
|
* @api public
|
|
2722
2799
|
*/
|
|
2723
2800
|
|
|
@@ -2736,6 +2813,7 @@ module.exports = function (chai, util) {
|
|
|
2736
2813
|
* @name isNumber
|
|
2737
2814
|
* @param {Number} value
|
|
2738
2815
|
* @param {String} message
|
|
2816
|
+
* @namespace Assert
|
|
2739
2817
|
* @api public
|
|
2740
2818
|
*/
|
|
2741
2819
|
|
|
@@ -2754,6 +2832,7 @@ module.exports = function (chai, util) {
|
|
|
2754
2832
|
* @name isNotNumber
|
|
2755
2833
|
* @param {Mixed} value
|
|
2756
2834
|
* @param {String} message
|
|
2835
|
+
* @namespace Assert
|
|
2757
2836
|
* @api public
|
|
2758
2837
|
*/
|
|
2759
2838
|
|
|
@@ -2775,6 +2854,7 @@ module.exports = function (chai, util) {
|
|
|
2775
2854
|
* @name isBoolean
|
|
2776
2855
|
* @param {Mixed} value
|
|
2777
2856
|
* @param {String} message
|
|
2857
|
+
* @namespace Assert
|
|
2778
2858
|
* @api public
|
|
2779
2859
|
*/
|
|
2780
2860
|
|
|
@@ -2796,6 +2876,7 @@ module.exports = function (chai, util) {
|
|
|
2796
2876
|
* @name isNotBoolean
|
|
2797
2877
|
* @param {Mixed} value
|
|
2798
2878
|
* @param {String} message
|
|
2879
|
+
* @namespace Assert
|
|
2799
2880
|
* @api public
|
|
2800
2881
|
*/
|
|
2801
2882
|
|
|
@@ -2820,6 +2901,7 @@ module.exports = function (chai, util) {
|
|
|
2820
2901
|
* @param {Mixed} value
|
|
2821
2902
|
* @param {String} name
|
|
2822
2903
|
* @param {String} message
|
|
2904
|
+
* @namespace Assert
|
|
2823
2905
|
* @api public
|
|
2824
2906
|
*/
|
|
2825
2907
|
|
|
@@ -2839,6 +2921,7 @@ module.exports = function (chai, util) {
|
|
|
2839
2921
|
* @param {Mixed} value
|
|
2840
2922
|
* @param {String} typeof name
|
|
2841
2923
|
* @param {String} message
|
|
2924
|
+
* @namespace Assert
|
|
2842
2925
|
* @api public
|
|
2843
2926
|
*/
|
|
2844
2927
|
|
|
@@ -2860,6 +2943,7 @@ module.exports = function (chai, util) {
|
|
|
2860
2943
|
* @param {Object} object
|
|
2861
2944
|
* @param {Constructor} constructor
|
|
2862
2945
|
* @param {String} message
|
|
2946
|
+
* @namespace Assert
|
|
2863
2947
|
* @api public
|
|
2864
2948
|
*/
|
|
2865
2949
|
|
|
@@ -2881,6 +2965,7 @@ module.exports = function (chai, util) {
|
|
|
2881
2965
|
* @param {Object} object
|
|
2882
2966
|
* @param {Constructor} constructor
|
|
2883
2967
|
* @param {String} message
|
|
2968
|
+
* @namespace Assert
|
|
2884
2969
|
* @api public
|
|
2885
2970
|
*/
|
|
2886
2971
|
|
|
@@ -2901,6 +2986,7 @@ module.exports = function (chai, util) {
|
|
|
2901
2986
|
* @param {Array|String} haystack
|
|
2902
2987
|
* @param {Mixed} needle
|
|
2903
2988
|
* @param {String} message
|
|
2989
|
+
* @namespace Assert
|
|
2904
2990
|
* @api public
|
|
2905
2991
|
*/
|
|
2906
2992
|
|
|
@@ -2921,6 +3007,7 @@ module.exports = function (chai, util) {
|
|
|
2921
3007
|
* @param {Array|String} haystack
|
|
2922
3008
|
* @param {Mixed} needle
|
|
2923
3009
|
* @param {String} message
|
|
3010
|
+
* @namespace Assert
|
|
2924
3011
|
* @api public
|
|
2925
3012
|
*/
|
|
2926
3013
|
|
|
@@ -2939,6 +3026,7 @@ module.exports = function (chai, util) {
|
|
|
2939
3026
|
* @param {Mixed} value
|
|
2940
3027
|
* @param {RegExp} regexp
|
|
2941
3028
|
* @param {String} message
|
|
3029
|
+
* @namespace Assert
|
|
2942
3030
|
* @api public
|
|
2943
3031
|
*/
|
|
2944
3032
|
|
|
@@ -2957,6 +3045,7 @@ module.exports = function (chai, util) {
|
|
|
2957
3045
|
* @param {Mixed} value
|
|
2958
3046
|
* @param {RegExp} regexp
|
|
2959
3047
|
* @param {String} message
|
|
3048
|
+
* @namespace Assert
|
|
2960
3049
|
* @api public
|
|
2961
3050
|
*/
|
|
2962
3051
|
|
|
@@ -2975,6 +3064,7 @@ module.exports = function (chai, util) {
|
|
|
2975
3064
|
* @param {Object} object
|
|
2976
3065
|
* @param {String} property
|
|
2977
3066
|
* @param {String} message
|
|
3067
|
+
* @namespace Assert
|
|
2978
3068
|
* @api public
|
|
2979
3069
|
*/
|
|
2980
3070
|
|
|
@@ -2993,6 +3083,7 @@ module.exports = function (chai, util) {
|
|
|
2993
3083
|
* @param {Object} object
|
|
2994
3084
|
* @param {String} property
|
|
2995
3085
|
* @param {String} message
|
|
3086
|
+
* @namespace Assert
|
|
2996
3087
|
* @api public
|
|
2997
3088
|
*/
|
|
2998
3089
|
|
|
@@ -3012,6 +3103,7 @@ module.exports = function (chai, util) {
|
|
|
3012
3103
|
* @param {Object} object
|
|
3013
3104
|
* @param {String} property
|
|
3014
3105
|
* @param {String} message
|
|
3106
|
+
* @namespace Assert
|
|
3015
3107
|
* @api public
|
|
3016
3108
|
*/
|
|
3017
3109
|
|
|
@@ -3031,6 +3123,7 @@ module.exports = function (chai, util) {
|
|
|
3031
3123
|
* @param {Object} object
|
|
3032
3124
|
* @param {String} property
|
|
3033
3125
|
* @param {String} message
|
|
3126
|
+
* @namespace Assert
|
|
3034
3127
|
* @api public
|
|
3035
3128
|
*/
|
|
3036
3129
|
|
|
@@ -3051,6 +3144,7 @@ module.exports = function (chai, util) {
|
|
|
3051
3144
|
* @param {String} property
|
|
3052
3145
|
* @param {Mixed} value
|
|
3053
3146
|
* @param {String} message
|
|
3147
|
+
* @namespace Assert
|
|
3054
3148
|
* @api public
|
|
3055
3149
|
*/
|
|
3056
3150
|
|
|
@@ -3071,6 +3165,7 @@ module.exports = function (chai, util) {
|
|
|
3071
3165
|
* @param {String} property
|
|
3072
3166
|
* @param {Mixed} value
|
|
3073
3167
|
* @param {String} message
|
|
3168
|
+
* @namespace Assert
|
|
3074
3169
|
* @api public
|
|
3075
3170
|
*/
|
|
3076
3171
|
|
|
@@ -3092,6 +3187,7 @@ module.exports = function (chai, util) {
|
|
|
3092
3187
|
* @param {String} property
|
|
3093
3188
|
* @param {Mixed} value
|
|
3094
3189
|
* @param {String} message
|
|
3190
|
+
* @namespace Assert
|
|
3095
3191
|
* @api public
|
|
3096
3192
|
*/
|
|
3097
3193
|
|
|
@@ -3113,6 +3209,7 @@ module.exports = function (chai, util) {
|
|
|
3113
3209
|
* @param {String} property
|
|
3114
3210
|
* @param {Mixed} value
|
|
3115
3211
|
* @param {String} message
|
|
3212
|
+
* @namespace Assert
|
|
3116
3213
|
* @api public
|
|
3117
3214
|
*/
|
|
3118
3215
|
|
|
@@ -3132,6 +3229,7 @@ module.exports = function (chai, util) {
|
|
|
3132
3229
|
* @param {Mixed} object
|
|
3133
3230
|
* @param {Number} length
|
|
3134
3231
|
* @param {String} message
|
|
3232
|
+
* @namespace Assert
|
|
3135
3233
|
* @api public
|
|
3136
3234
|
*/
|
|
3137
3235
|
|
|
@@ -3160,6 +3258,7 @@ module.exports = function (chai, util) {
|
|
|
3160
3258
|
* @param {RegExp} regexp
|
|
3161
3259
|
* @param {String} message
|
|
3162
3260
|
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
|
3261
|
+
* @namespace Assert
|
|
3163
3262
|
* @api public
|
|
3164
3263
|
*/
|
|
3165
3264
|
|
|
@@ -3188,6 +3287,7 @@ module.exports = function (chai, util) {
|
|
|
3188
3287
|
* @param {RegExp} regexp
|
|
3189
3288
|
* @param {String} message
|
|
3190
3289
|
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
|
3290
|
+
* @namespace Assert
|
|
3191
3291
|
* @api public
|
|
3192
3292
|
*/
|
|
3193
3293
|
|
|
@@ -3213,6 +3313,7 @@ module.exports = function (chai, util) {
|
|
|
3213
3313
|
* @param {String} operator
|
|
3214
3314
|
* @param {Mixed} val2
|
|
3215
3315
|
* @param {String} message
|
|
3316
|
+
* @namespace Assert
|
|
3216
3317
|
* @api public
|
|
3217
3318
|
*/
|
|
3218
3319
|
|
|
@@ -3265,6 +3366,7 @@ module.exports = function (chai, util) {
|
|
|
3265
3366
|
* @param {Number} expected
|
|
3266
3367
|
* @param {Number} delta
|
|
3267
3368
|
* @param {String} message
|
|
3369
|
+
* @namespace Assert
|
|
3268
3370
|
* @api public
|
|
3269
3371
|
*/
|
|
3270
3372
|
|
|
@@ -3284,6 +3386,7 @@ module.exports = function (chai, util) {
|
|
|
3284
3386
|
* @param {Number} expected
|
|
3285
3387
|
* @param {Number} delta
|
|
3286
3388
|
* @param {String} message
|
|
3389
|
+
* @namespace Assert
|
|
3287
3390
|
* @api public
|
|
3288
3391
|
*/
|
|
3289
3392
|
|
|
@@ -3303,6 +3406,7 @@ module.exports = function (chai, util) {
|
|
|
3303
3406
|
* @param {Array} set1
|
|
3304
3407
|
* @param {Array} set2
|
|
3305
3408
|
* @param {String} message
|
|
3409
|
+
* @namespace Assert
|
|
3306
3410
|
* @api public
|
|
3307
3411
|
*/
|
|
3308
3412
|
|
|
@@ -3322,6 +3426,7 @@ module.exports = function (chai, util) {
|
|
|
3322
3426
|
* @param {Array} set1
|
|
3323
3427
|
* @param {Array} set2
|
|
3324
3428
|
* @param {String} message
|
|
3429
|
+
* @namespace Assert
|
|
3325
3430
|
* @api public
|
|
3326
3431
|
*/
|
|
3327
3432
|
|
|
@@ -3341,6 +3446,7 @@ module.exports = function (chai, util) {
|
|
|
3341
3446
|
* @param {Array} superset
|
|
3342
3447
|
* @param {Array} subset
|
|
3343
3448
|
* @param {String} message
|
|
3449
|
+
* @namespace Assert
|
|
3344
3450
|
* @api public
|
|
3345
3451
|
*/
|
|
3346
3452
|
|
|
@@ -3348,6 +3454,27 @@ module.exports = function (chai, util) {
|
|
|
3348
3454
|
new Assertion(superset, msg).to.include.members(subset);
|
|
3349
3455
|
}
|
|
3350
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
|
+
|
|
3351
3478
|
/**
|
|
3352
3479
|
* ### .oneOf(inList, list, [message])
|
|
3353
3480
|
*
|
|
@@ -3359,6 +3486,7 @@ module.exports = function (chai, util) {
|
|
|
3359
3486
|
* @param {*} inList
|
|
3360
3487
|
* @param {Array<*>} list
|
|
3361
3488
|
* @param {String} message
|
|
3489
|
+
* @namespace Assert
|
|
3362
3490
|
* @api public
|
|
3363
3491
|
*/
|
|
3364
3492
|
|
|
@@ -3380,6 +3508,7 @@ module.exports = function (chai, util) {
|
|
|
3380
3508
|
* @param {Object} object
|
|
3381
3509
|
* @param {String} property name
|
|
3382
3510
|
* @param {String} message _optional_
|
|
3511
|
+
* @namespace Assert
|
|
3383
3512
|
* @api public
|
|
3384
3513
|
*/
|
|
3385
3514
|
|
|
@@ -3401,6 +3530,7 @@ module.exports = function (chai, util) {
|
|
|
3401
3530
|
* @param {Object} object
|
|
3402
3531
|
* @param {String} property name
|
|
3403
3532
|
* @param {String} message _optional_
|
|
3533
|
+
* @namespace Assert
|
|
3404
3534
|
* @api public
|
|
3405
3535
|
*/
|
|
3406
3536
|
|
|
@@ -3422,6 +3552,7 @@ module.exports = function (chai, util) {
|
|
|
3422
3552
|
* @param {Object} object
|
|
3423
3553
|
* @param {String} property name
|
|
3424
3554
|
* @param {String} message _optional_
|
|
3555
|
+
* @namespace Assert
|
|
3425
3556
|
* @api public
|
|
3426
3557
|
*/
|
|
3427
3558
|
|
|
@@ -3443,6 +3574,7 @@ module.exports = function (chai, util) {
|
|
|
3443
3574
|
* @param {Object} object
|
|
3444
3575
|
* @param {String} property name
|
|
3445
3576
|
* @param {String} message _optional_
|
|
3577
|
+
* @namespace Assert
|
|
3446
3578
|
* @api public
|
|
3447
3579
|
*/
|
|
3448
3580
|
|
|
@@ -3464,6 +3596,7 @@ module.exports = function (chai, util) {
|
|
|
3464
3596
|
* @param {Object} object
|
|
3465
3597
|
* @param {String} property name
|
|
3466
3598
|
* @param {String} message _optional_
|
|
3599
|
+
* @namespace Assert
|
|
3467
3600
|
* @api public
|
|
3468
3601
|
*/
|
|
3469
3602
|
|
|
@@ -3485,6 +3618,7 @@ module.exports = function (chai, util) {
|
|
|
3485
3618
|
* @param {Object} object
|
|
3486
3619
|
* @param {String} property name
|
|
3487
3620
|
* @param {String} message _optional_
|
|
3621
|
+
* @namespace Assert
|
|
3488
3622
|
* @api public
|
|
3489
3623
|
*/
|
|
3490
3624
|
|
|
@@ -3504,6 +3638,7 @@ module.exports = function (chai, util) {
|
|
|
3504
3638
|
*
|
|
3505
3639
|
* @name ifError
|
|
3506
3640
|
* @param {Object} object
|
|
3641
|
+
* @namespace Assert
|
|
3507
3642
|
* @api public
|
|
3508
3643
|
*/
|
|
3509
3644
|
|
|
@@ -3524,6 +3659,7 @@ module.exports = function (chai, util) {
|
|
|
3524
3659
|
* @alias extensible
|
|
3525
3660
|
* @param {Object} object
|
|
3526
3661
|
* @param {String} message _optional_
|
|
3662
|
+
* @namespace Assert
|
|
3527
3663
|
* @api public
|
|
3528
3664
|
*/
|
|
3529
3665
|
|
|
@@ -3548,6 +3684,7 @@ module.exports = function (chai, util) {
|
|
|
3548
3684
|
* @alias notExtensible
|
|
3549
3685
|
* @param {Object} object
|
|
3550
3686
|
* @param {String} message _optional_
|
|
3687
|
+
* @namespace Assert
|
|
3551
3688
|
* @api public
|
|
3552
3689
|
*/
|
|
3553
3690
|
|
|
@@ -3571,6 +3708,7 @@ module.exports = function (chai, util) {
|
|
|
3571
3708
|
* @alias sealed
|
|
3572
3709
|
* @param {Object} object
|
|
3573
3710
|
* @param {String} message _optional_
|
|
3711
|
+
* @namespace Assert
|
|
3574
3712
|
* @api public
|
|
3575
3713
|
*/
|
|
3576
3714
|
|
|
@@ -3589,6 +3727,7 @@ module.exports = function (chai, util) {
|
|
|
3589
3727
|
* @alias notSealed
|
|
3590
3728
|
* @param {Object} object
|
|
3591
3729
|
* @param {String} message _optional_
|
|
3730
|
+
* @namespace Assert
|
|
3592
3731
|
* @api public
|
|
3593
3732
|
*/
|
|
3594
3733
|
|
|
@@ -3609,6 +3748,7 @@ module.exports = function (chai, util) {
|
|
|
3609
3748
|
* @alias frozen
|
|
3610
3749
|
* @param {Object} object
|
|
3611
3750
|
* @param {String} message _optional_
|
|
3751
|
+
* @namespace Assert
|
|
3612
3752
|
* @api public
|
|
3613
3753
|
*/
|
|
3614
3754
|
|
|
@@ -3627,6 +3767,7 @@ module.exports = function (chai, util) {
|
|
|
3627
3767
|
* @alias notFrozen
|
|
3628
3768
|
* @param {Object} object
|
|
3629
3769
|
* @param {String} message _optional_
|
|
3770
|
+
* @namespace Assert
|
|
3630
3771
|
* @api public
|
|
3631
3772
|
*/
|
|
3632
3773
|
|
|
@@ -3676,6 +3817,7 @@ module.exports = function (chai, util) {
|
|
|
3676
3817
|
* @param {Mixed} expected
|
|
3677
3818
|
* @param {String} message
|
|
3678
3819
|
* @param {String} operator
|
|
3820
|
+
* @namespace Expect
|
|
3679
3821
|
* @api public
|
|
3680
3822
|
*/
|
|
3681
3823
|
|
|
@@ -3740,6 +3882,7 @@ module.exports = function (chai, util) {
|
|
|
3740
3882
|
* @param {Mixed} expected
|
|
3741
3883
|
* @param {String} message
|
|
3742
3884
|
* @param {String} operator
|
|
3885
|
+
* @namespace Should
|
|
3743
3886
|
* @api public
|
|
3744
3887
|
*/
|
|
3745
3888
|
|
|
@@ -3752,14 +3895,67 @@ module.exports = function (chai, util) {
|
|
|
3752
3895
|
}, should.fail);
|
|
3753
3896
|
};
|
|
3754
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
|
+
|
|
3755
3913
|
should.equal = function (val1, val2, msg) {
|
|
3756
3914
|
new Assertion(val1, msg).to.equal(val2);
|
|
3757
3915
|
};
|
|
3758
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
|
+
|
|
3759
3941
|
should.Throw = function (fn, errt, errs, msg) {
|
|
3760
3942
|
new Assertion(fn, msg).to.Throw(errt, errs);
|
|
3761
3943
|
};
|
|
3762
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
|
+
|
|
3763
3959
|
should.exist = function (val, msg) {
|
|
3764
3960
|
new Assertion(val, msg).to.exist;
|
|
3765
3961
|
}
|
|
@@ -3767,14 +3963,63 @@ module.exports = function (chai, util) {
|
|
|
3767
3963
|
// negation
|
|
3768
3964
|
should.not = {}
|
|
3769
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
|
+
|
|
3770
3981
|
should.not.equal = function (val1, val2, msg) {
|
|
3771
3982
|
new Assertion(val1, msg).to.not.equal(val2);
|
|
3772
3983
|
};
|
|
3773
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
|
+
|
|
3774
4005
|
should.not.Throw = function (fn, errt, errs, msg) {
|
|
3775
4006
|
new Assertion(fn, msg).to.not.Throw(errt, errs);
|
|
3776
4007
|
};
|
|
3777
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
|
+
|
|
3778
4023
|
should.not.exist = function (val, msg) {
|
|
3779
4024
|
new Assertion(val, msg).to.not.exist;
|
|
3780
4025
|
}
|
|
@@ -3844,6 +4089,7 @@ var call = Function.prototype.call,
|
|
|
3844
4089
|
* @param {String} name of method to add
|
|
3845
4090
|
* @param {Function} method function to be used for `name`, when called
|
|
3846
4091
|
* @param {Function} chainingBehavior function to be called every time the property is accessed
|
|
4092
|
+
* @namespace Utils
|
|
3847
4093
|
* @name addChainableMethod
|
|
3848
4094
|
* @api public
|
|
3849
4095
|
*/
|
|
@@ -3932,6 +4178,7 @@ var config = require('../config');
|
|
|
3932
4178
|
* @param {Object} ctx object to which the method is added
|
|
3933
4179
|
* @param {String} name of method to add
|
|
3934
4180
|
* @param {Function} method function to be used for name
|
|
4181
|
+
* @namespace Utils
|
|
3935
4182
|
* @name addMethod
|
|
3936
4183
|
* @api public
|
|
3937
4184
|
*/
|
|
@@ -3978,6 +4225,7 @@ var flag = require('./flag');
|
|
|
3978
4225
|
* @param {Object} ctx object to which the property is added
|
|
3979
4226
|
* @param {String} name of property to add
|
|
3980
4227
|
* @param {Function} getter function to be used for name
|
|
4228
|
+
* @namespace Utils
|
|
3981
4229
|
* @name addProperty
|
|
3982
4230
|
* @api public
|
|
3983
4231
|
*/
|
|
@@ -4012,6 +4260,7 @@ module.exports = function (ctx, name, getter) {
|
|
|
4012
4260
|
*
|
|
4013
4261
|
* @param {Mixed} obj constructed Assertion
|
|
4014
4262
|
* @param {Array} type A list of allowed types for this assertion
|
|
4263
|
+
* @namespace Utils
|
|
4015
4264
|
* @name expectTypes
|
|
4016
4265
|
* @api public
|
|
4017
4266
|
*/
|
|
@@ -4060,6 +4309,7 @@ module.exports = function (obj, types) {
|
|
|
4060
4309
|
* @param {Object} object constructed Assertion
|
|
4061
4310
|
* @param {String} key
|
|
4062
4311
|
* @param {Mixed} value (optional)
|
|
4312
|
+
* @namespace Utils
|
|
4063
4313
|
* @name flag
|
|
4064
4314
|
* @api private
|
|
4065
4315
|
*/
|
|
@@ -4087,6 +4337,8 @@ module.exports = function (obj, key, value) {
|
|
|
4087
4337
|
*
|
|
4088
4338
|
* @param {Object} object (constructed Assertion)
|
|
4089
4339
|
* @param {Arguments} chai.Assertion.prototype.assert arguments
|
|
4340
|
+
* @namespace Utils
|
|
4341
|
+
* @name getActual
|
|
4090
4342
|
*/
|
|
4091
4343
|
|
|
4092
4344
|
module.exports = function (obj, args) {
|
|
@@ -4108,6 +4360,7 @@ module.exports = function (obj, args) {
|
|
|
4108
4360
|
*
|
|
4109
4361
|
* @param {Object} object
|
|
4110
4362
|
* @returns {Array}
|
|
4363
|
+
* @namespace Utils
|
|
4111
4364
|
* @name getEnumerableProperties
|
|
4112
4365
|
* @api public
|
|
4113
4366
|
*/
|
|
@@ -4150,6 +4403,7 @@ var flag = require('./flag')
|
|
|
4150
4403
|
*
|
|
4151
4404
|
* @param {Object} object (constructed Assertion)
|
|
4152
4405
|
* @param {Arguments} chai.Assertion.prototype.assert arguments
|
|
4406
|
+
* @namespace Utils
|
|
4153
4407
|
* @name getMessage
|
|
4154
4408
|
* @api public
|
|
4155
4409
|
*/
|
|
@@ -4165,9 +4419,9 @@ module.exports = function (obj, args) {
|
|
|
4165
4419
|
if(typeof msg === "function") msg = msg();
|
|
4166
4420
|
msg = msg || '';
|
|
4167
4421
|
msg = msg
|
|
4168
|
-
.replace(
|
|
4169
|
-
.replace(
|
|
4170
|
-
.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); });
|
|
4171
4425
|
|
|
4172
4426
|
return flagMsg ? flagMsg + ': ' + msg : msg;
|
|
4173
4427
|
};
|
|
@@ -4185,6 +4439,8 @@ module.exports = function (obj, args) {
|
|
|
4185
4439
|
* Gets the name of a function, in a cross-browser way.
|
|
4186
4440
|
*
|
|
4187
4441
|
* @param {Function} a function (usually a constructor)
|
|
4442
|
+
* @namespace Utils
|
|
4443
|
+
* @name getName
|
|
4188
4444
|
*/
|
|
4189
4445
|
|
|
4190
4446
|
module.exports = function (func) {
|
|
@@ -4220,6 +4476,7 @@ var hasProperty = require('./hasProperty');
|
|
|
4220
4476
|
* @param {String} path
|
|
4221
4477
|
* @param {Object} object
|
|
4222
4478
|
* @returns {Object} info
|
|
4479
|
+
* @namespace Utils
|
|
4223
4480
|
* @name getPathInfo
|
|
4224
4481
|
* @api public
|
|
4225
4482
|
*/
|
|
@@ -4342,13 +4599,14 @@ var getPathInfo = require('./getPathInfo');
|
|
|
4342
4599
|
* @param {String} path
|
|
4343
4600
|
* @param {Object} object
|
|
4344
4601
|
* @returns {Object} value or `undefined`
|
|
4602
|
+
* @namespace Utils
|
|
4345
4603
|
* @name getPathValue
|
|
4346
4604
|
* @api public
|
|
4347
4605
|
*/
|
|
4348
4606
|
module.exports = function(path, obj) {
|
|
4349
4607
|
var info = getPathInfo(path, obj);
|
|
4350
4608
|
return info.value;
|
|
4351
|
-
};
|
|
4609
|
+
};
|
|
4352
4610
|
|
|
4353
4611
|
},{"./getPathInfo":18}],20:[function(require,module,exports){
|
|
4354
4612
|
/*!
|
|
@@ -4365,6 +4623,7 @@ module.exports = function(path, obj) {
|
|
|
4365
4623
|
*
|
|
4366
4624
|
* @param {Object} object
|
|
4367
4625
|
* @returns {Array}
|
|
4626
|
+
* @namespace Utils
|
|
4368
4627
|
* @name getProperties
|
|
4369
4628
|
* @api public
|
|
4370
4629
|
*/
|
|
@@ -4416,7 +4675,7 @@ var type = require('type-detect');
|
|
|
4416
4675
|
* hasProperty('str', obj); // true
|
|
4417
4676
|
* hasProperty('constructor', obj); // true
|
|
4418
4677
|
* hasProperty('bar', obj); // false
|
|
4419
|
-
*
|
|
4678
|
+
*
|
|
4420
4679
|
* hasProperty('length', obj.str); // true
|
|
4421
4680
|
* hasProperty(1, obj.str); // true
|
|
4422
4681
|
* hasProperty(5, obj.str); // false
|
|
@@ -4428,6 +4687,7 @@ var type = require('type-detect');
|
|
|
4428
4687
|
* @param {Objuect} object
|
|
4429
4688
|
* @param {String|Number} name
|
|
4430
4689
|
* @returns {Boolean} whether it exists
|
|
4690
|
+
* @namespace Utils
|
|
4431
4691
|
* @name getPathInfo
|
|
4432
4692
|
* @api public
|
|
4433
4693
|
*/
|
|
@@ -4604,6 +4864,8 @@ module.exports = inspect;
|
|
|
4604
4864
|
* @param {Number} depth Depth in which to descend in object. Default is 2.
|
|
4605
4865
|
* @param {Boolean} colors Flag to turn on ANSI escape codes to color the
|
|
4606
4866
|
* output. Default is false (no coloring).
|
|
4867
|
+
* @namespace Utils
|
|
4868
|
+
* @name inspect
|
|
4607
4869
|
*/
|
|
4608
4870
|
function inspect(obj, showHidden, depth, colors) {
|
|
4609
4871
|
var ctx = {
|
|
@@ -4942,6 +5204,7 @@ var config = require('../config');
|
|
|
4942
5204
|
*
|
|
4943
5205
|
* @param {Mixed} javascript object to inspect
|
|
4944
5206
|
* @name objDisplay
|
|
5207
|
+
* @namespace Utils
|
|
4945
5208
|
* @api public
|
|
4946
5209
|
*/
|
|
4947
5210
|
|
|
@@ -5005,6 +5268,7 @@ module.exports = function (obj) {
|
|
|
5005
5268
|
* @param {String} name of method / property to overwrite
|
|
5006
5269
|
* @param {Function} method function that returns a function to be used for name
|
|
5007
5270
|
* @param {Function} chainingBehavior function that returns a function to be used for property
|
|
5271
|
+
* @namespace Utils
|
|
5008
5272
|
* @name overwriteChainableMethod
|
|
5009
5273
|
* @api public
|
|
5010
5274
|
*/
|
|
@@ -5061,6 +5325,7 @@ module.exports = function (ctx, name, method, chainingBehavior) {
|
|
|
5061
5325
|
* @param {Object} ctx object whose method is to be overwritten
|
|
5062
5326
|
* @param {String} name of method to overwrite
|
|
5063
5327
|
* @param {Function} method function that returns a function to be used for name
|
|
5328
|
+
* @namespace Utils
|
|
5064
5329
|
* @name overwriteMethod
|
|
5065
5330
|
* @api public
|
|
5066
5331
|
*/
|
|
@@ -5114,6 +5379,7 @@ module.exports = function (ctx, name, method) {
|
|
|
5114
5379
|
* @param {Object} ctx object whose property is to be overwritten
|
|
5115
5380
|
* @param {String} name of property to overwrite
|
|
5116
5381
|
* @param {Function} getter function that returns a getter function to be used for name
|
|
5382
|
+
* @namespace Utils
|
|
5117
5383
|
* @name overwriteProperty
|
|
5118
5384
|
* @api public
|
|
5119
5385
|
*/
|
|
@@ -5154,6 +5420,8 @@ var flag = require('./flag');
|
|
|
5154
5420
|
*
|
|
5155
5421
|
* @param {Object} object (constructed Assertion)
|
|
5156
5422
|
* @param {Arguments} chai.Assertion.prototype.assert arguments
|
|
5423
|
+
* @namespace Utils
|
|
5424
|
+
* @name test
|
|
5157
5425
|
*/
|
|
5158
5426
|
|
|
5159
5427
|
module.exports = function (obj, args) {
|
|
@@ -5187,6 +5455,7 @@ module.exports = function (obj, args) {
|
|
|
5187
5455
|
* @param {Assertion} assertion the assertion to transfer the flags from
|
|
5188
5456
|
* @param {Object} object the object to transfer the flags to; usually a new assertion
|
|
5189
5457
|
* @param {Boolean} includeAll
|
|
5458
|
+
* @namespace Utils
|
|
5190
5459
|
* @name transferFlags
|
|
5191
5460
|
* @api private
|
|
5192
5461
|
*/
|