chai 2.3.0 → 3.3.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/CONTRIBUTING.md +21 -17
- package/History.md +7 -0
- package/README.md +35 -84
- package/ReleaseNotes.md +7 -0
- package/bower.json +0 -1
- package/chai.js +3928 -3623
- package/karma.conf.js +1 -1
- package/lib/chai/assertion.js +2 -2
- package/lib/chai/core/assertions.js +192 -32
- package/lib/chai/interface/assert.js +286 -37
- package/lib/chai/utils/addProperty.js +8 -1
- package/lib/chai/utils/getPathInfo.js +1 -1
- package/lib/chai/utils/getProperties.js +2 -2
- package/lib/chai/utils/hasProperty.js +1 -1
- package/lib/chai/utils/index.js +1 -1
- package/lib/chai.js +1 -1
- package/package.json +13 -11
- package/lib/chai/utils/type.js +0 -45
|
@@ -64,38 +64,40 @@ module.exports = function (chai, util) {
|
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
|
-
* ### .
|
|
67
|
+
* ### .isOk(object, [message])
|
|
68
68
|
*
|
|
69
69
|
* Asserts that `object` is truthy.
|
|
70
70
|
*
|
|
71
|
-
* assert.
|
|
72
|
-
* assert.
|
|
71
|
+
* assert.isOk('everything', 'everything is ok');
|
|
72
|
+
* assert.isOk(false, 'this will fail');
|
|
73
73
|
*
|
|
74
|
-
* @name
|
|
74
|
+
* @name isOk
|
|
75
|
+
* @alias ok
|
|
75
76
|
* @param {Mixed} object to test
|
|
76
77
|
* @param {String} message
|
|
77
78
|
* @api public
|
|
78
79
|
*/
|
|
79
80
|
|
|
80
|
-
assert.
|
|
81
|
+
assert.isOk = function (val, msg) {
|
|
81
82
|
new Assertion(val, msg).is.ok;
|
|
82
83
|
};
|
|
83
84
|
|
|
84
85
|
/**
|
|
85
|
-
* ### .
|
|
86
|
+
* ### .isNotOk(object, [message])
|
|
86
87
|
*
|
|
87
88
|
* Asserts that `object` is falsy.
|
|
88
89
|
*
|
|
89
|
-
* assert.
|
|
90
|
-
* assert.
|
|
90
|
+
* assert.isNotOk('everything', 'this will fail');
|
|
91
|
+
* assert.isNotOk(false, 'this will pass');
|
|
91
92
|
*
|
|
92
|
-
* @name
|
|
93
|
+
* @name isNotOk
|
|
94
|
+
* @alias notOk
|
|
93
95
|
* @param {Mixed} object to test
|
|
94
96
|
* @param {String} message
|
|
95
97
|
* @api public
|
|
96
98
|
*/
|
|
97
99
|
|
|
98
|
-
assert.
|
|
100
|
+
assert.isNotOk = function (val, msg) {
|
|
99
101
|
new Assertion(val, msg).is.not.ok;
|
|
100
102
|
};
|
|
101
103
|
|
|
@@ -223,16 +225,16 @@ module.exports = function (chai, util) {
|
|
|
223
225
|
new Assertion(act, msg).to.not.eql(exp);
|
|
224
226
|
};
|
|
225
227
|
|
|
226
|
-
|
|
227
|
-
* ### .
|
|
228
|
+
/**
|
|
229
|
+
* ### .isAbove(valueToCheck, valueToBeAbove, [message])
|
|
228
230
|
*
|
|
229
|
-
* Asserts
|
|
231
|
+
* Asserts `valueToCheck` is strictly greater than (>) `valueToBeAbove`
|
|
230
232
|
*
|
|
231
|
-
*
|
|
232
|
-
* assert.isTrue(teaServed, 'the tea has been served');
|
|
233
|
+
* assert.isAbove(5, 2, '5 is strictly greater than 2');
|
|
233
234
|
*
|
|
234
|
-
* @name
|
|
235
|
-
* @param {Mixed}
|
|
235
|
+
* @name isAbove
|
|
236
|
+
* @param {Mixed} valueToCheck
|
|
237
|
+
* @param {Mixed} valueToBeAbove
|
|
236
238
|
* @param {String} message
|
|
237
239
|
* @api public
|
|
238
240
|
*/
|
|
@@ -242,21 +244,22 @@ module.exports = function (chai, util) {
|
|
|
242
244
|
};
|
|
243
245
|
|
|
244
246
|
/**
|
|
245
|
-
* ### .
|
|
247
|
+
* ### .isAtLeast(valueToCheck, valueToBeAtLeast, [message])
|
|
246
248
|
*
|
|
247
|
-
* Asserts `valueToCheck` is
|
|
249
|
+
* Asserts `valueToCheck` is greater than or equal to (>=) `valueToBeAtLeast`
|
|
248
250
|
*
|
|
249
|
-
* assert.
|
|
251
|
+
* assert.isAtLeast(5, 2, '5 is greater or equal to 2');
|
|
252
|
+
* assert.isAtLeast(3, 3, '3 is greater or equal to 3');
|
|
250
253
|
*
|
|
251
|
-
* @name
|
|
254
|
+
* @name isAtLeast
|
|
252
255
|
* @param {Mixed} valueToCheck
|
|
253
|
-
* @param {Mixed}
|
|
256
|
+
* @param {Mixed} valueToBeAtLeast
|
|
254
257
|
* @param {String} message
|
|
255
258
|
* @api public
|
|
256
259
|
*/
|
|
257
260
|
|
|
258
|
-
assert.
|
|
259
|
-
new Assertion(val, msg).to.be.
|
|
261
|
+
assert.isAtLeast = function (val, atlst, msg) {
|
|
262
|
+
new Assertion(val, msg).to.be.least(atlst);
|
|
260
263
|
};
|
|
261
264
|
|
|
262
265
|
/**
|
|
@@ -273,10 +276,65 @@ module.exports = function (chai, util) {
|
|
|
273
276
|
* @api public
|
|
274
277
|
*/
|
|
275
278
|
|
|
279
|
+
assert.isBelow = function (val, blw, msg) {
|
|
280
|
+
new Assertion(val, msg).to.be.below(blw);
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* ### .isAtMost(valueToCheck, valueToBeAtMost, [message])
|
|
285
|
+
*
|
|
286
|
+
* Asserts `valueToCheck` is less than or equal to (<=) `valueToBeAtMost`
|
|
287
|
+
*
|
|
288
|
+
* assert.isAtMost(3, 6, '3 is less than or equal to 6');
|
|
289
|
+
* assert.isAtMost(4, 4, '4 is less than or equal to 4');
|
|
290
|
+
*
|
|
291
|
+
* @name isAtMost
|
|
292
|
+
* @param {Mixed} valueToCheck
|
|
293
|
+
* @param {Mixed} valueToBeAtMost
|
|
294
|
+
* @param {String} message
|
|
295
|
+
* @api public
|
|
296
|
+
*/
|
|
297
|
+
|
|
298
|
+
assert.isAtMost = function (val, atmst, msg) {
|
|
299
|
+
new Assertion(val, msg).to.be.most(atmst);
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* ### .isTrue(value, [message])
|
|
304
|
+
*
|
|
305
|
+
* Asserts that `value` is true.
|
|
306
|
+
*
|
|
307
|
+
* var teaServed = true;
|
|
308
|
+
* assert.isTrue(teaServed, 'the tea has been served');
|
|
309
|
+
*
|
|
310
|
+
* @name isTrue
|
|
311
|
+
* @param {Mixed} value
|
|
312
|
+
* @param {String} message
|
|
313
|
+
* @api public
|
|
314
|
+
*/
|
|
315
|
+
|
|
276
316
|
assert.isTrue = function (val, msg) {
|
|
277
317
|
new Assertion(val, msg).is['true'];
|
|
278
318
|
};
|
|
279
319
|
|
|
320
|
+
/**
|
|
321
|
+
* ### .isNotTrue(value, [message])
|
|
322
|
+
*
|
|
323
|
+
* Asserts that `value` is not true.
|
|
324
|
+
*
|
|
325
|
+
* var tea = 'tasty chai';
|
|
326
|
+
* assert.isNotTrue(tea, 'great, time for tea!');
|
|
327
|
+
*
|
|
328
|
+
* @name isNotTrue
|
|
329
|
+
* @param {Mixed} value
|
|
330
|
+
* @param {String} message
|
|
331
|
+
* @api public
|
|
332
|
+
*/
|
|
333
|
+
|
|
334
|
+
assert.isNotTrue = function (val, msg) {
|
|
335
|
+
new Assertion(val, msg).to.not.equal(true);
|
|
336
|
+
};
|
|
337
|
+
|
|
280
338
|
/**
|
|
281
339
|
* ### .isFalse(value, [message])
|
|
282
340
|
*
|
|
@@ -295,6 +353,24 @@ module.exports = function (chai, util) {
|
|
|
295
353
|
new Assertion(val, msg).is['false'];
|
|
296
354
|
};
|
|
297
355
|
|
|
356
|
+
/**
|
|
357
|
+
* ### .isNotFalse(value, [message])
|
|
358
|
+
*
|
|
359
|
+
* Asserts that `value` is not false.
|
|
360
|
+
*
|
|
361
|
+
* var tea = 'tasty chai';
|
|
362
|
+
* assert.isNotFalse(tea, 'great, time for tea!');
|
|
363
|
+
*
|
|
364
|
+
* @name isNotFalse
|
|
365
|
+
* @param {Mixed} value
|
|
366
|
+
* @param {String} message
|
|
367
|
+
* @api public
|
|
368
|
+
*/
|
|
369
|
+
|
|
370
|
+
assert.isNotFalse = function (val, msg) {
|
|
371
|
+
new Assertion(val, msg).to.not.equal(false);
|
|
372
|
+
};
|
|
373
|
+
|
|
298
374
|
/**
|
|
299
375
|
* ### .isNull(value, [message])
|
|
300
376
|
*
|
|
@@ -330,6 +406,37 @@ module.exports = function (chai, util) {
|
|
|
330
406
|
new Assertion(val, msg).to.not.equal(null);
|
|
331
407
|
};
|
|
332
408
|
|
|
409
|
+
/**
|
|
410
|
+
* ### .isNaN
|
|
411
|
+
* Asserts that value is NaN
|
|
412
|
+
*
|
|
413
|
+
* assert.isNaN('foo', 'foo is NaN');
|
|
414
|
+
*
|
|
415
|
+
* @name isNaN
|
|
416
|
+
* @param {Mixed} value
|
|
417
|
+
* @param {String} message
|
|
418
|
+
* @api public
|
|
419
|
+
*/
|
|
420
|
+
|
|
421
|
+
assert.isNaN = function (val, msg) {
|
|
422
|
+
new Assertion(val, msg).to.be.NaN;
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* ### .isNotNaN
|
|
427
|
+
* Asserts that value is not NaN
|
|
428
|
+
*
|
|
429
|
+
* assert.isNotNaN(4, '4 is not NaN');
|
|
430
|
+
*
|
|
431
|
+
* @name isNotNaN
|
|
432
|
+
* @param {Mixed} value
|
|
433
|
+
* @param {String} message
|
|
434
|
+
* @api public
|
|
435
|
+
*/
|
|
436
|
+
assert.isNotNaN = function (val, msg) {
|
|
437
|
+
new Assertion(val, msg).not.to.be.NaN;
|
|
438
|
+
};
|
|
439
|
+
|
|
333
440
|
/**
|
|
334
441
|
* ### .isUndefined(value, [message])
|
|
335
442
|
*
|
|
@@ -700,7 +807,7 @@ module.exports = function (chai, util) {
|
|
|
700
807
|
*
|
|
701
808
|
* Asserts that `haystack` does not include `needle`. Works
|
|
702
809
|
* for strings and arrays.
|
|
703
|
-
*
|
|
810
|
+
*
|
|
704
811
|
* assert.notInclude('foobar', 'baz', 'string not include substring');
|
|
705
812
|
* assert.notInclude([ 1, 2, 3 ], 4, 'array not include contain value');
|
|
706
813
|
*
|
|
@@ -933,11 +1040,11 @@ module.exports = function (chai, util) {
|
|
|
933
1040
|
* `constructor`, or alternately that it will throw an error with message
|
|
934
1041
|
* matching `regexp`.
|
|
935
1042
|
*
|
|
936
|
-
* assert.
|
|
937
|
-
* assert.
|
|
938
|
-
* assert.
|
|
939
|
-
* assert.
|
|
940
|
-
* assert.
|
|
1043
|
+
* assert.throws(fn, 'function throws a reference error');
|
|
1044
|
+
* assert.throws(fn, /function throws a reference error/);
|
|
1045
|
+
* assert.throws(fn, ReferenceError);
|
|
1046
|
+
* assert.throws(fn, ReferenceError, 'function throws a reference error');
|
|
1047
|
+
* assert.throws(fn, ReferenceError, /function throws a reference error/);
|
|
941
1048
|
*
|
|
942
1049
|
* @name throws
|
|
943
1050
|
* @alias throw
|
|
@@ -950,13 +1057,13 @@ module.exports = function (chai, util) {
|
|
|
950
1057
|
* @api public
|
|
951
1058
|
*/
|
|
952
1059
|
|
|
953
|
-
assert.
|
|
1060
|
+
assert.throws = function (fn, errt, errs, msg) {
|
|
954
1061
|
if ('string' === typeof errt || errt instanceof RegExp) {
|
|
955
1062
|
errs = errt;
|
|
956
1063
|
errt = null;
|
|
957
1064
|
}
|
|
958
1065
|
|
|
959
|
-
var assertErr = new Assertion(fn, msg).to.
|
|
1066
|
+
var assertErr = new Assertion(fn, msg).to.throw(errt, errs);
|
|
960
1067
|
return flag(assertErr, 'object');
|
|
961
1068
|
};
|
|
962
1069
|
|
|
@@ -1243,11 +1350,145 @@ module.exports = function (chai, util) {
|
|
|
1243
1350
|
}
|
|
1244
1351
|
|
|
1245
1352
|
/*!
|
|
1246
|
-
*
|
|
1353
|
+
* ### .ifError(object)
|
|
1354
|
+
*
|
|
1355
|
+
* Asserts if value is not a false value, and throws if it is a true value.
|
|
1356
|
+
* This is added to allow for chai to be a drop-in replacement for Node's
|
|
1357
|
+
* assert class.
|
|
1358
|
+
*
|
|
1359
|
+
* var err = new Error('I am a custom error');
|
|
1360
|
+
* assert.ifError(err); // Rethrows err!
|
|
1361
|
+
*
|
|
1362
|
+
* @name ifError
|
|
1363
|
+
* @param {Object} object
|
|
1364
|
+
* @api public
|
|
1365
|
+
*/
|
|
1366
|
+
|
|
1367
|
+
assert.ifError = function (val) {
|
|
1368
|
+
if (val) {
|
|
1369
|
+
throw(val);
|
|
1370
|
+
}
|
|
1371
|
+
};
|
|
1372
|
+
|
|
1373
|
+
/**
|
|
1374
|
+
* ### .isExtensible(object)
|
|
1375
|
+
*
|
|
1376
|
+
* Asserts that `object` is extensible (can have new properties added to it).
|
|
1377
|
+
*
|
|
1378
|
+
* assert.isExtensible({});
|
|
1379
|
+
*
|
|
1380
|
+
* @name isExtensible
|
|
1381
|
+
* @alias extensible
|
|
1382
|
+
* @param {Object} object
|
|
1383
|
+
* @param {String} message _optional_
|
|
1384
|
+
* @api public
|
|
1385
|
+
*/
|
|
1386
|
+
|
|
1387
|
+
assert.isExtensible = function (obj, msg) {
|
|
1388
|
+
new Assertion(obj, msg).to.be.extensible;
|
|
1389
|
+
};
|
|
1390
|
+
|
|
1391
|
+
/**
|
|
1392
|
+
* ### .isNotExtensible(object)
|
|
1393
|
+
*
|
|
1394
|
+
* Asserts that `object` is _not_ extensible.
|
|
1395
|
+
*
|
|
1396
|
+
* var nonExtensibleObject = Object.preventExtensions({});
|
|
1397
|
+
* var sealedObject = Object.seal({});
|
|
1398
|
+
* var frozenObject = Object.freese({});
|
|
1399
|
+
*
|
|
1400
|
+
* assert.isNotExtensible(nonExtensibleObject);
|
|
1401
|
+
* assert.isNotExtensible(sealedObject);
|
|
1402
|
+
* assert.isNotExtensible(frozenObject);
|
|
1403
|
+
*
|
|
1404
|
+
* @name isNotExtensible
|
|
1405
|
+
* @alias notExtensible
|
|
1406
|
+
* @param {Object} object
|
|
1407
|
+
* @param {String} message _optional_
|
|
1408
|
+
* @api public
|
|
1409
|
+
*/
|
|
1410
|
+
|
|
1411
|
+
assert.isNotExtensible = function (obj, msg) {
|
|
1412
|
+
new Assertion(obj, msg).to.not.be.extensible;
|
|
1413
|
+
};
|
|
1414
|
+
|
|
1415
|
+
/**
|
|
1416
|
+
* ### .isSealed(object)
|
|
1417
|
+
*
|
|
1418
|
+
* Asserts that `object` is sealed (cannot have new properties added to it
|
|
1419
|
+
* and its existing properties cannot be removed).
|
|
1420
|
+
*
|
|
1421
|
+
* var sealedObject = Object.seal({});
|
|
1422
|
+
* var frozenObject = Object.seal({});
|
|
1423
|
+
*
|
|
1424
|
+
* assert.isSealed(sealedObject);
|
|
1425
|
+
* assert.isSealed(frozenObject);
|
|
1426
|
+
*
|
|
1427
|
+
* @name isSealed
|
|
1428
|
+
* @alias sealed
|
|
1429
|
+
* @param {Object} object
|
|
1430
|
+
* @param {String} message _optional_
|
|
1431
|
+
* @api public
|
|
1432
|
+
*/
|
|
1433
|
+
|
|
1434
|
+
assert.isSealed = function (obj, msg) {
|
|
1435
|
+
new Assertion(obj, msg).to.be.sealed;
|
|
1436
|
+
};
|
|
1437
|
+
|
|
1438
|
+
/**
|
|
1439
|
+
* ### .isNotSealed(object)
|
|
1440
|
+
*
|
|
1441
|
+
* Asserts that `object` is _not_ sealed.
|
|
1442
|
+
*
|
|
1443
|
+
* assert.isNotSealed({});
|
|
1444
|
+
*
|
|
1445
|
+
* @name isNotSealed
|
|
1446
|
+
* @alias notSealed
|
|
1447
|
+
* @param {Object} object
|
|
1448
|
+
* @param {String} message _optional_
|
|
1449
|
+
* @api public
|
|
1450
|
+
*/
|
|
1451
|
+
|
|
1452
|
+
assert.isNotSealed = function (obj, msg) {
|
|
1453
|
+
new Assertion(obj, msg).to.not.be.sealed;
|
|
1454
|
+
};
|
|
1455
|
+
|
|
1456
|
+
/**
|
|
1457
|
+
* ### .isFrozen(object)
|
|
1458
|
+
*
|
|
1459
|
+
* Asserts that `object` is frozen (cannot have new properties added to it
|
|
1460
|
+
* and its existing properties cannot be modified).
|
|
1461
|
+
*
|
|
1462
|
+
* var frozenObject = Object.freeze({});
|
|
1463
|
+
* assert.frozen(frozenObject);
|
|
1464
|
+
*
|
|
1465
|
+
* @name isFrozen
|
|
1466
|
+
* @alias frozen
|
|
1467
|
+
* @param {Object} object
|
|
1468
|
+
* @param {String} message _optional_
|
|
1469
|
+
* @api public
|
|
1470
|
+
*/
|
|
1471
|
+
|
|
1472
|
+
assert.isFrozen = function (obj, msg) {
|
|
1473
|
+
new Assertion(obj, msg).to.be.frozen;
|
|
1474
|
+
};
|
|
1475
|
+
|
|
1476
|
+
/**
|
|
1477
|
+
* ### .isNotFrozen(object)
|
|
1478
|
+
*
|
|
1479
|
+
* Asserts that `object` is _not_ frozen.
|
|
1480
|
+
*
|
|
1481
|
+
* assert.isNotFrozen({});
|
|
1482
|
+
*
|
|
1483
|
+
* @name isNotFrozen
|
|
1484
|
+
* @alias notFrozen
|
|
1485
|
+
* @param {Object} object
|
|
1486
|
+
* @param {String} message _optional_
|
|
1487
|
+
* @api public
|
|
1247
1488
|
*/
|
|
1248
1489
|
|
|
1249
|
-
assert.
|
|
1250
|
-
new Assertion(
|
|
1490
|
+
assert.isNotFrozen = function (obj, msg) {
|
|
1491
|
+
new Assertion(obj, msg).to.not.be.frozen;
|
|
1251
1492
|
};
|
|
1252
1493
|
|
|
1253
1494
|
/*!
|
|
@@ -1258,6 +1499,14 @@ module.exports = function (chai, util) {
|
|
|
1258
1499
|
assert[as] = assert[name];
|
|
1259
1500
|
return alias;
|
|
1260
1501
|
})
|
|
1261
|
-
('
|
|
1262
|
-
('
|
|
1502
|
+
('isOk', 'ok')
|
|
1503
|
+
('isNotOk', 'notOk')
|
|
1504
|
+
('throws', 'throw')
|
|
1505
|
+
('throws', 'Throw')
|
|
1506
|
+
('isExtensible', 'extensible')
|
|
1507
|
+
('isNotExtensible', 'notExtensible')
|
|
1508
|
+
('isSealed', 'sealed')
|
|
1509
|
+
('isNotSealed', 'notSealed')
|
|
1510
|
+
('isFrozen', 'frozen')
|
|
1511
|
+
('isNotFrozen', 'notFrozen');
|
|
1263
1512
|
};
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
* MIT Licensed
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
var config = require('../config');
|
|
8
|
+
var flag = require('./flag');
|
|
9
|
+
|
|
7
10
|
/**
|
|
8
11
|
* ### addProperty (ctx, name, getter)
|
|
9
12
|
*
|
|
@@ -31,7 +34,11 @@
|
|
|
31
34
|
|
|
32
35
|
module.exports = function (ctx, name, getter) {
|
|
33
36
|
Object.defineProperty(ctx, name,
|
|
34
|
-
{ get: function () {
|
|
37
|
+
{ get: function addProperty() {
|
|
38
|
+
var old_ssfi = flag(this, 'ssfi');
|
|
39
|
+
if (old_ssfi && config.includeStack === false)
|
|
40
|
+
flag(this, 'ssfi', addProperty);
|
|
41
|
+
|
|
35
42
|
var result = getter.call(this);
|
|
36
43
|
return result === undefined ? this : result;
|
|
37
44
|
}
|
|
@@ -34,7 +34,7 @@ module.exports = function getPathInfo(path, obj) {
|
|
|
34
34
|
var info = {
|
|
35
35
|
parent: parsed.length > 1 ? _getPathValue(parsed, obj, parsed.length - 1) : obj,
|
|
36
36
|
name: last.p || last.i,
|
|
37
|
-
value: _getPathValue(parsed, obj)
|
|
37
|
+
value: _getPathValue(parsed, obj)
|
|
38
38
|
};
|
|
39
39
|
info.exists = hasProperty(info.name, info.parent);
|
|
40
40
|
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
module.exports = function getProperties(object) {
|
|
20
|
-
var result = Object.getOwnPropertyNames(
|
|
20
|
+
var result = Object.getOwnPropertyNames(object);
|
|
21
21
|
|
|
22
22
|
function addProperty(property) {
|
|
23
23
|
if (result.indexOf(property) === -1) {
|
|
@@ -25,7 +25,7 @@ module.exports = function getProperties(object) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
var proto = Object.getPrototypeOf(
|
|
28
|
+
var proto = Object.getPrototypeOf(object);
|
|
29
29
|
while (proto !== null) {
|
|
30
30
|
Object.getOwnPropertyNames(proto).forEach(addProperty);
|
|
31
31
|
proto = Object.getPrototypeOf(proto);
|
package/lib/chai/utils/index.js
CHANGED
package/lib/chai.js
CHANGED
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"Veselin Todorov <hi@vesln.com>",
|
|
18
18
|
"John Firebaugh <john.firebaugh@gmail.com>"
|
|
19
19
|
],
|
|
20
|
-
"version": "
|
|
20
|
+
"version": "3.3.0",
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
23
23
|
"url": "https://github.com/chaijs/chai"
|
|
@@ -33,17 +33,19 @@
|
|
|
33
33
|
"node": ">= 0.4.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"assertion-error": "1.0.
|
|
37
|
-
"deep-eql": "0.1.3"
|
|
36
|
+
"assertion-error": "^1.0.1",
|
|
37
|
+
"deep-eql": "^0.1.3",
|
|
38
|
+
"type-detect": "^1.0.0"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"karma
|
|
43
|
-
"karma-
|
|
44
|
-
"karma-
|
|
45
|
-
"karma-
|
|
46
|
-
"
|
|
47
|
-
"
|
|
41
|
+
"browserify": "^10.2.1",
|
|
42
|
+
"bump-cli": "^1.1.3",
|
|
43
|
+
"karma": "^0.12.0",
|
|
44
|
+
"karma-mocha": "^0.1.10",
|
|
45
|
+
"karma-sauce-launcher": "^0.2.11",
|
|
46
|
+
"karma-phantomjs-launcher": "^0.2.0",
|
|
47
|
+
"karma-firefox-launcher": "^0.1.6",
|
|
48
|
+
"mocha": "^2.2.5",
|
|
49
|
+
"istanbul": "^0.3.14"
|
|
48
50
|
}
|
|
49
51
|
}
|
package/lib/chai/utils/type.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Chai - type utility
|
|
3
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
4
|
-
* MIT Licensed
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/*!
|
|
8
|
-
* Detectable javascript natives
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
var natives = {
|
|
12
|
-
'[object Arguments]': 'arguments'
|
|
13
|
-
, '[object Array]': 'array'
|
|
14
|
-
, '[object Date]': 'date'
|
|
15
|
-
, '[object Function]': 'function'
|
|
16
|
-
, '[object Number]': 'number'
|
|
17
|
-
, '[object RegExp]': 'regexp'
|
|
18
|
-
, '[object String]': 'string'
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* ### type(object)
|
|
23
|
-
*
|
|
24
|
-
* Better implementation of `typeof` detection that can
|
|
25
|
-
* be used cross-browser. Handles the inconsistencies of
|
|
26
|
-
* Array, `null`, and `undefined` detection.
|
|
27
|
-
*
|
|
28
|
-
* utils.type({}) // 'object'
|
|
29
|
-
* utils.type(null) // `null'
|
|
30
|
-
* utils.type(undefined) // `undefined`
|
|
31
|
-
* utils.type([]) // `array`
|
|
32
|
-
*
|
|
33
|
-
* @param {Mixed} object to detect type of
|
|
34
|
-
* @name type
|
|
35
|
-
* @api private
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
module.exports = function (obj) {
|
|
39
|
-
var str = Object.prototype.toString.call(obj);
|
|
40
|
-
if (natives[str]) return natives[str];
|
|
41
|
-
if (obj === null) return 'null';
|
|
42
|
-
if (obj === undefined) return 'undefined';
|
|
43
|
-
if (obj === Object(obj)) return 'object';
|
|
44
|
-
return typeof obj;
|
|
45
|
-
};
|