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
|
@@ -35,6 +35,7 @@ module.exports = function (chai, _) {
|
|
|
35
35
|
* - same
|
|
36
36
|
*
|
|
37
37
|
* @name language chains
|
|
38
|
+
* @namespace BDD
|
|
38
39
|
* @api public
|
|
39
40
|
*/
|
|
40
41
|
|
|
@@ -58,6 +59,7 @@ module.exports = function (chai, _) {
|
|
|
58
59
|
* .and.not.equal('bar');
|
|
59
60
|
*
|
|
60
61
|
* @name not
|
|
62
|
+
* @namespace BDD
|
|
61
63
|
* @api public
|
|
62
64
|
*/
|
|
63
65
|
|
|
@@ -82,6 +84,7 @@ module.exports = function (chai, _) {
|
|
|
82
84
|
* expect(deepCss).to.have.deep.property('\\.link.\\[target\\]', 42);
|
|
83
85
|
*
|
|
84
86
|
* @name deep
|
|
87
|
+
* @namespace BDD
|
|
85
88
|
* @api public
|
|
86
89
|
*/
|
|
87
90
|
|
|
@@ -98,6 +101,7 @@ module.exports = function (chai, _) {
|
|
|
98
101
|
* expect(foo).to.have.any.keys('bar', 'baz');
|
|
99
102
|
*
|
|
100
103
|
* @name any
|
|
104
|
+
* @namespace BDD
|
|
101
105
|
* @api public
|
|
102
106
|
*/
|
|
103
107
|
|
|
@@ -116,6 +120,7 @@ module.exports = function (chai, _) {
|
|
|
116
120
|
* expect(foo).to.have.all.keys('bar', 'baz');
|
|
117
121
|
*
|
|
118
122
|
* @name all
|
|
123
|
+
* @namespace BDD
|
|
119
124
|
* @api public
|
|
120
125
|
*/
|
|
121
126
|
|
|
@@ -151,6 +156,7 @@ module.exports = function (chai, _) {
|
|
|
151
156
|
* @alias an
|
|
152
157
|
* @param {String} type
|
|
153
158
|
* @param {String} message _optional_
|
|
159
|
+
* @namespace BDD
|
|
154
160
|
* @api public
|
|
155
161
|
*/
|
|
156
162
|
|
|
@@ -188,6 +194,7 @@ module.exports = function (chai, _) {
|
|
|
188
194
|
* @alias contains
|
|
189
195
|
* @param {Object|String|Number} obj
|
|
190
196
|
* @param {String} message _optional_
|
|
197
|
+
* @namespace BDD
|
|
191
198
|
* @api public
|
|
192
199
|
*/
|
|
193
200
|
|
|
@@ -243,6 +250,7 @@ module.exports = function (chai, _) {
|
|
|
243
250
|
* expect(null).to.not.be.ok;
|
|
244
251
|
*
|
|
245
252
|
* @name ok
|
|
253
|
+
* @namespace BDD
|
|
246
254
|
* @api public
|
|
247
255
|
*/
|
|
248
256
|
|
|
@@ -262,6 +270,7 @@ module.exports = function (chai, _) {
|
|
|
262
270
|
* expect(1).to.not.be.true;
|
|
263
271
|
*
|
|
264
272
|
* @name true
|
|
273
|
+
* @namespace BDD
|
|
265
274
|
* @api public
|
|
266
275
|
*/
|
|
267
276
|
|
|
@@ -283,6 +292,7 @@ module.exports = function (chai, _) {
|
|
|
283
292
|
* expect(0).to.not.be.false;
|
|
284
293
|
*
|
|
285
294
|
* @name false
|
|
295
|
+
* @namespace BDD
|
|
286
296
|
* @api public
|
|
287
297
|
*/
|
|
288
298
|
|
|
@@ -304,6 +314,7 @@ module.exports = function (chai, _) {
|
|
|
304
314
|
* expect(undefined).to.not.be.null;
|
|
305
315
|
*
|
|
306
316
|
* @name null
|
|
317
|
+
* @namespace BDD
|
|
307
318
|
* @api public
|
|
308
319
|
*/
|
|
309
320
|
|
|
@@ -324,6 +335,7 @@ module.exports = function (chai, _) {
|
|
|
324
335
|
* expect(null).to.not.be.undefined;
|
|
325
336
|
*
|
|
326
337
|
* @name undefined
|
|
338
|
+
* @namespace BDD
|
|
327
339
|
* @api public
|
|
328
340
|
*/
|
|
329
341
|
|
|
@@ -343,6 +355,7 @@ module.exports = function (chai, _) {
|
|
|
343
355
|
* expect(4).not.to.be.NaN;
|
|
344
356
|
*
|
|
345
357
|
* @name NaN
|
|
358
|
+
* @namespace BDD
|
|
346
359
|
* @api public
|
|
347
360
|
*/
|
|
348
361
|
|
|
@@ -368,6 +381,7 @@ module.exports = function (chai, _) {
|
|
|
368
381
|
* expect(baz).to.not.exist;
|
|
369
382
|
*
|
|
370
383
|
* @name exist
|
|
384
|
+
* @namespace BDD
|
|
371
385
|
* @api public
|
|
372
386
|
*/
|
|
373
387
|
|
|
@@ -392,6 +406,7 @@ module.exports = function (chai, _) {
|
|
|
392
406
|
* expect({}).to.be.empty;
|
|
393
407
|
*
|
|
394
408
|
* @name empty
|
|
409
|
+
* @namespace BDD
|
|
395
410
|
* @api public
|
|
396
411
|
*/
|
|
397
412
|
|
|
@@ -423,6 +438,7 @@ module.exports = function (chai, _) {
|
|
|
423
438
|
*
|
|
424
439
|
* @name arguments
|
|
425
440
|
* @alias Arguments
|
|
441
|
+
* @namespace BDD
|
|
426
442
|
* @api public
|
|
427
443
|
*/
|
|
428
444
|
|
|
@@ -458,6 +474,7 @@ module.exports = function (chai, _) {
|
|
|
458
474
|
* @alias deep.equal
|
|
459
475
|
* @param {Mixed} value
|
|
460
476
|
* @param {String} message _optional_
|
|
477
|
+
* @namespace BDD
|
|
461
478
|
* @api public
|
|
462
479
|
*/
|
|
463
480
|
|
|
@@ -494,6 +511,7 @@ module.exports = function (chai, _) {
|
|
|
494
511
|
* @alias eqls
|
|
495
512
|
* @param {Mixed} value
|
|
496
513
|
* @param {String} message _optional_
|
|
514
|
+
* @namespace BDD
|
|
497
515
|
* @api public
|
|
498
516
|
*/
|
|
499
517
|
|
|
@@ -532,6 +550,7 @@ module.exports = function (chai, _) {
|
|
|
532
550
|
* @alias greaterThan
|
|
533
551
|
* @param {Number} value
|
|
534
552
|
* @param {String} message _optional_
|
|
553
|
+
* @namespace BDD
|
|
535
554
|
* @api public
|
|
536
555
|
*/
|
|
537
556
|
|
|
@@ -580,6 +599,7 @@ module.exports = function (chai, _) {
|
|
|
580
599
|
* @alias gte
|
|
581
600
|
* @param {Number} value
|
|
582
601
|
* @param {String} message _optional_
|
|
602
|
+
* @namespace BDD
|
|
583
603
|
* @api public
|
|
584
604
|
*/
|
|
585
605
|
|
|
@@ -628,6 +648,7 @@ module.exports = function (chai, _) {
|
|
|
628
648
|
* @alias lessThan
|
|
629
649
|
* @param {Number} value
|
|
630
650
|
* @param {String} message _optional_
|
|
651
|
+
* @namespace BDD
|
|
631
652
|
* @api public
|
|
632
653
|
*/
|
|
633
654
|
|
|
@@ -676,6 +697,7 @@ module.exports = function (chai, _) {
|
|
|
676
697
|
* @alias lte
|
|
677
698
|
* @param {Number} value
|
|
678
699
|
* @param {String} message _optional_
|
|
700
|
+
* @namespace BDD
|
|
679
701
|
* @api public
|
|
680
702
|
*/
|
|
681
703
|
|
|
@@ -723,6 +745,7 @@ module.exports = function (chai, _) {
|
|
|
723
745
|
* @param {Number} start lowerbound inclusive
|
|
724
746
|
* @param {Number} finish upperbound inclusive
|
|
725
747
|
* @param {String} message _optional_
|
|
748
|
+
* @namespace BDD
|
|
726
749
|
* @api public
|
|
727
750
|
*/
|
|
728
751
|
|
|
@@ -762,6 +785,7 @@ module.exports = function (chai, _) {
|
|
|
762
785
|
* @param {Constructor} constructor
|
|
763
786
|
* @param {String} message _optional_
|
|
764
787
|
* @alias instanceOf
|
|
788
|
+
* @namespace BDD
|
|
765
789
|
* @api public
|
|
766
790
|
*/
|
|
767
791
|
|
|
@@ -846,6 +870,7 @@ module.exports = function (chai, _) {
|
|
|
846
870
|
* @param {Mixed} value (optional)
|
|
847
871
|
* @param {String} message _optional_
|
|
848
872
|
* @returns value of property for chaining
|
|
873
|
+
* @namespace BDD
|
|
849
874
|
* @api public
|
|
850
875
|
*/
|
|
851
876
|
|
|
@@ -901,6 +926,7 @@ module.exports = function (chai, _) {
|
|
|
901
926
|
* @alias haveOwnProperty
|
|
902
927
|
* @param {String} name
|
|
903
928
|
* @param {String} message _optional_
|
|
929
|
+
* @namespace BDD
|
|
904
930
|
* @api public
|
|
905
931
|
*/
|
|
906
932
|
|
|
@@ -933,6 +959,7 @@ module.exports = function (chai, _) {
|
|
|
933
959
|
* @param {String} name
|
|
934
960
|
* @param {Object} descriptor _optional_
|
|
935
961
|
* @param {String} message _optional_
|
|
962
|
+
* @namespace BDD
|
|
936
963
|
* @api public
|
|
937
964
|
*/
|
|
938
965
|
|
|
@@ -985,6 +1012,7 @@ module.exports = function (chai, _) {
|
|
|
985
1012
|
* switched to use `lengthOf(value)` instead.
|
|
986
1013
|
*
|
|
987
1014
|
* @name length
|
|
1015
|
+
* @namespace BDD
|
|
988
1016
|
* @api public
|
|
989
1017
|
*/
|
|
990
1018
|
|
|
@@ -1000,6 +1028,7 @@ module.exports = function (chai, _) {
|
|
|
1000
1028
|
* @name lengthOf
|
|
1001
1029
|
* @param {Number} length
|
|
1002
1030
|
* @param {String} message _optional_
|
|
1031
|
+
* @namespace BDD
|
|
1003
1032
|
* @api public
|
|
1004
1033
|
*/
|
|
1005
1034
|
|
|
@@ -1036,6 +1065,7 @@ module.exports = function (chai, _) {
|
|
|
1036
1065
|
* @alias matches
|
|
1037
1066
|
* @param {RegExp} RegularExpression
|
|
1038
1067
|
* @param {String} message _optional_
|
|
1068
|
+
* @namespace BDD
|
|
1039
1069
|
* @api public
|
|
1040
1070
|
*/
|
|
1041
1071
|
function assertMatch(re, msg) {
|
|
@@ -1061,6 +1091,7 @@ module.exports = function (chai, _) {
|
|
|
1061
1091
|
* @name string
|
|
1062
1092
|
* @param {String} string
|
|
1063
1093
|
* @param {String} message _optional_
|
|
1094
|
+
* @namespace BDD
|
|
1064
1095
|
* @api public
|
|
1065
1096
|
*/
|
|
1066
1097
|
|
|
@@ -1112,6 +1143,7 @@ module.exports = function (chai, _) {
|
|
|
1112
1143
|
* @name keys
|
|
1113
1144
|
* @alias key
|
|
1114
1145
|
* @param {...String|Array|Object} keys
|
|
1146
|
+
* @namespace BDD
|
|
1115
1147
|
* @api public
|
|
1116
1148
|
*/
|
|
1117
1149
|
|
|
@@ -1231,6 +1263,7 @@ module.exports = function (chai, _) {
|
|
|
1231
1263
|
* @param {String} message _optional_
|
|
1232
1264
|
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
|
1233
1265
|
* @returns error for chaining (null if no error)
|
|
1266
|
+
* @namespace BDD
|
|
1234
1267
|
* @api public
|
|
1235
1268
|
*/
|
|
1236
1269
|
|
|
@@ -1374,6 +1407,7 @@ module.exports = function (chai, _) {
|
|
|
1374
1407
|
* @alias respondsTo
|
|
1375
1408
|
* @param {String} method
|
|
1376
1409
|
* @param {String} message _optional_
|
|
1410
|
+
* @namespace BDD
|
|
1377
1411
|
* @api public
|
|
1378
1412
|
*/
|
|
1379
1413
|
|
|
@@ -1408,6 +1442,7 @@ module.exports = function (chai, _) {
|
|
|
1408
1442
|
* expect(Foo).itself.not.to.respondTo('baz');
|
|
1409
1443
|
*
|
|
1410
1444
|
* @name itself
|
|
1445
|
+
* @namespace BDD
|
|
1411
1446
|
* @api public
|
|
1412
1447
|
*/
|
|
1413
1448
|
|
|
@@ -1426,6 +1461,7 @@ module.exports = function (chai, _) {
|
|
|
1426
1461
|
* @alias satisfies
|
|
1427
1462
|
* @param {Function} matcher
|
|
1428
1463
|
* @param {String} message _optional_
|
|
1464
|
+
* @namespace BDD
|
|
1429
1465
|
* @api public
|
|
1430
1466
|
*/
|
|
1431
1467
|
|
|
@@ -1457,6 +1493,7 @@ module.exports = function (chai, _) {
|
|
|
1457
1493
|
* @param {Number} expected
|
|
1458
1494
|
* @param {Number} delta
|
|
1459
1495
|
* @param {String} message _optional_
|
|
1496
|
+
* @namespace BDD
|
|
1460
1497
|
* @api public
|
|
1461
1498
|
*/
|
|
1462
1499
|
|
|
@@ -1508,6 +1545,7 @@ module.exports = function (chai, _) {
|
|
|
1508
1545
|
* @name members
|
|
1509
1546
|
* @param {Array} set
|
|
1510
1547
|
* @param {String} message _optional_
|
|
1548
|
+
* @namespace BDD
|
|
1511
1549
|
* @api public
|
|
1512
1550
|
*/
|
|
1513
1551
|
|
|
@@ -1557,6 +1595,7 @@ module.exports = function (chai, _) {
|
|
|
1557
1595
|
* @name oneOf
|
|
1558
1596
|
* @param {Array<*>} list
|
|
1559
1597
|
* @param {String} message _optional_
|
|
1598
|
+
* @namespace BDD
|
|
1560
1599
|
* @api public
|
|
1561
1600
|
*/
|
|
1562
1601
|
|
|
@@ -1586,7 +1625,7 @@ module.exports = function (chai, _) {
|
|
|
1586
1625
|
* var fn = function() { obj.val += 3 };
|
|
1587
1626
|
* var noChangeFn = function() { return 'foo' + 'bar'; }
|
|
1588
1627
|
* expect(fn).to.change(obj, 'val');
|
|
1589
|
-
* expect(
|
|
1628
|
+
* expect(noChangeFn).to.not.change(obj, 'val')
|
|
1590
1629
|
*
|
|
1591
1630
|
* @name change
|
|
1592
1631
|
* @alias changes
|
|
@@ -1594,6 +1633,7 @@ module.exports = function (chai, _) {
|
|
|
1594
1633
|
* @param {String} object
|
|
1595
1634
|
* @param {String} property name
|
|
1596
1635
|
* @param {String} message _optional_
|
|
1636
|
+
* @namespace BDD
|
|
1597
1637
|
* @api public
|
|
1598
1638
|
*/
|
|
1599
1639
|
|
|
@@ -1631,6 +1671,7 @@ module.exports = function (chai, _) {
|
|
|
1631
1671
|
* @param {String} object
|
|
1632
1672
|
* @param {String} property name
|
|
1633
1673
|
* @param {String} message _optional_
|
|
1674
|
+
* @namespace BDD
|
|
1634
1675
|
* @api public
|
|
1635
1676
|
*/
|
|
1636
1677
|
|
|
@@ -1668,6 +1709,7 @@ module.exports = function (chai, _) {
|
|
|
1668
1709
|
* @param {String} object
|
|
1669
1710
|
* @param {String} property name
|
|
1670
1711
|
* @param {String} message _optional_
|
|
1712
|
+
* @namespace BDD
|
|
1671
1713
|
* @api public
|
|
1672
1714
|
*/
|
|
1673
1715
|
|
|
@@ -1706,6 +1748,7 @@ module.exports = function (chai, _) {
|
|
|
1706
1748
|
* expect(frozenObject).to.not.be.extensible;
|
|
1707
1749
|
*
|
|
1708
1750
|
* @name extensible
|
|
1751
|
+
* @namespace BDD
|
|
1709
1752
|
* @api public
|
|
1710
1753
|
*/
|
|
1711
1754
|
|
|
@@ -1747,6 +1790,7 @@ module.exports = function (chai, _) {
|
|
|
1747
1790
|
* expect({}).to.not.be.sealed;
|
|
1748
1791
|
*
|
|
1749
1792
|
* @name sealed
|
|
1793
|
+
* @namespace BDD
|
|
1750
1794
|
* @api public
|
|
1751
1795
|
*/
|
|
1752
1796
|
|
|
@@ -1786,6 +1830,7 @@ module.exports = function (chai, _) {
|
|
|
1786
1830
|
* expect({}).to.not.be.frozen;
|
|
1787
1831
|
*
|
|
1788
1832
|
* @name frozen
|
|
1833
|
+
* @namespace BDD
|
|
1789
1834
|
* @api public
|
|
1790
1835
|
*/
|
|
1791
1836
|
|