chai 1.7.2 → 1.9.1

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/chai.js CHANGED
@@ -27,10 +27,14 @@ function require(path, parent, orig) {
27
27
  // perform real require()
28
28
  // by invoking the module's
29
29
  // registered function
30
- if (!module.exports) {
31
- module.exports = {};
32
- module.client = module.component = true;
33
- module.call(this, module.exports, require.relative(resolved), module);
30
+ if (!module._resolving && !module.exports) {
31
+ var mod = {};
32
+ mod.exports = {};
33
+ mod.client = mod.component = true;
34
+ module._resolving = true;
35
+ module.call(this, mod.exports, require.relative(resolved), mod);
36
+ delete module._resolving;
37
+ module.exports = mod.exports;
34
38
  }
35
39
 
36
40
  return module.exports;
@@ -308,6 +312,411 @@ AssertionError.prototype.toJSON = function (stack) {
308
312
  return props;
309
313
  };
310
314
 
315
+ });
316
+ require.register("chaijs-type-detect/lib/type.js", function(exports, require, module){
317
+ /*!
318
+ * type-detect
319
+ * Copyright(c) 2013 jake luer <jake@alogicalparadox.com>
320
+ * MIT Licensed
321
+ */
322
+
323
+ /*!
324
+ * Primary Exports
325
+ */
326
+
327
+ var exports = module.exports = getType;
328
+
329
+ /*!
330
+ * Detectable javascript natives
331
+ */
332
+
333
+ var natives = {
334
+ '[object Array]': 'array'
335
+ , '[object RegExp]': 'regexp'
336
+ , '[object Function]': 'function'
337
+ , '[object Arguments]': 'arguments'
338
+ , '[object Date]': 'date'
339
+ };
340
+
341
+ /**
342
+ * ### typeOf (obj)
343
+ *
344
+ * Use several different techniques to determine
345
+ * the type of object being tested.
346
+ *
347
+ *
348
+ * @param {Mixed} object
349
+ * @return {String} object type
350
+ * @api public
351
+ */
352
+
353
+ function getType (obj) {
354
+ var str = Object.prototype.toString.call(obj);
355
+ if (natives[str]) return natives[str];
356
+ if (obj === null) return 'null';
357
+ if (obj === undefined) return 'undefined';
358
+ if (obj === Object(obj)) return 'object';
359
+ return typeof obj;
360
+ }
361
+
362
+ exports.Library = Library;
363
+
364
+ /**
365
+ * ### Library
366
+ *
367
+ * Create a repository for custom type detection.
368
+ *
369
+ * ```js
370
+ * var lib = new type.Library;
371
+ * ```
372
+ *
373
+ */
374
+
375
+ function Library () {
376
+ this.tests = {};
377
+ }
378
+
379
+ /**
380
+ * #### .of (obj)
381
+ *
382
+ * Expose replacement `typeof` detection to the library.
383
+ *
384
+ * ```js
385
+ * if ('string' === lib.of('hello world')) {
386
+ * // ...
387
+ * }
388
+ * ```
389
+ *
390
+ * @param {Mixed} object to test
391
+ * @return {String} type
392
+ */
393
+
394
+ Library.prototype.of = getType;
395
+
396
+ /**
397
+ * #### .define (type, test)
398
+ *
399
+ * Add a test to for the `.test()` assertion.
400
+ *
401
+ * Can be defined as a regular expression:
402
+ *
403
+ * ```js
404
+ * lib.define('int', /^[0-9]+$/);
405
+ * ```
406
+ *
407
+ * ... or as a function:
408
+ *
409
+ * ```js
410
+ * lib.define('bln', function (obj) {
411
+ * if ('boolean' === lib.of(obj)) return true;
412
+ * var blns = [ 'yes', 'no', 'true', 'false', 1, 0 ];
413
+ * if ('string' === lib.of(obj)) obj = obj.toLowerCase();
414
+ * return !! ~blns.indexOf(obj);
415
+ * });
416
+ * ```
417
+ *
418
+ * @param {String} type
419
+ * @param {RegExp|Function} test
420
+ * @api public
421
+ */
422
+
423
+ Library.prototype.define = function (type, test) {
424
+ if (arguments.length === 1) return this.tests[type];
425
+ this.tests[type] = test;
426
+ return this;
427
+ };
428
+
429
+ /**
430
+ * #### .test (obj, test)
431
+ *
432
+ * Assert that an object is of type. Will first
433
+ * check natives, and if that does not pass it will
434
+ * use the user defined custom tests.
435
+ *
436
+ * ```js
437
+ * assert(lib.test('1', 'int'));
438
+ * assert(lib.test('yes', 'bln'));
439
+ * ```
440
+ *
441
+ * @param {Mixed} object
442
+ * @param {String} type
443
+ * @return {Boolean} result
444
+ * @api public
445
+ */
446
+
447
+ Library.prototype.test = function (obj, type) {
448
+ if (type === getType(obj)) return true;
449
+ var test = this.tests[type];
450
+
451
+ if (test && 'regexp' === getType(test)) {
452
+ return test.test(obj);
453
+ } else if (test && 'function' === getType(test)) {
454
+ return test(obj);
455
+ } else {
456
+ throw new ReferenceError('Type test "' + type + '" not defined or invalid.');
457
+ }
458
+ };
459
+
460
+ });
461
+ require.register("chaijs-deep-eql/lib/eql.js", function(exports, require, module){
462
+ /*!
463
+ * deep-eql
464
+ * Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>
465
+ * MIT Licensed
466
+ */
467
+
468
+ /*!
469
+ * Module dependencies
470
+ */
471
+
472
+ var type = require('type-detect');
473
+
474
+ /*!
475
+ * Buffer.isBuffer browser shim
476
+ */
477
+
478
+ var Buffer;
479
+ try { Buffer = require('buffer').Buffer; }
480
+ catch(ex) {
481
+ Buffer = {};
482
+ Buffer.isBuffer = function() { return false; }
483
+ }
484
+
485
+ /*!
486
+ * Primary Export
487
+ */
488
+
489
+ module.exports = deepEqual;
490
+
491
+ /**
492
+ * Assert super-strict (egal) equality between
493
+ * two objects of any type.
494
+ *
495
+ * @param {Mixed} a
496
+ * @param {Mixed} b
497
+ * @param {Array} memoised (optional)
498
+ * @return {Boolean} equal match
499
+ */
500
+
501
+ function deepEqual(a, b, m) {
502
+ if (sameValue(a, b)) {
503
+ return true;
504
+ } else if ('date' === type(a)) {
505
+ return dateEqual(a, b);
506
+ } else if ('regexp' === type(a)) {
507
+ return regexpEqual(a, b);
508
+ } else if (Buffer.isBuffer(a)) {
509
+ return bufferEqual(a, b);
510
+ } else if ('arguments' === type(a)) {
511
+ return argumentsEqual(a, b, m);
512
+ } else if (!typeEqual(a, b)) {
513
+ return false;
514
+ } else if (('object' !== type(a) && 'object' !== type(b))
515
+ && ('array' !== type(a) && 'array' !== type(b))) {
516
+ return sameValue(a, b);
517
+ } else {
518
+ return objectEqual(a, b, m);
519
+ }
520
+ }
521
+
522
+ /*!
523
+ * Strict (egal) equality test. Ensures that NaN always
524
+ * equals NaN and `-0` does not equal `+0`.
525
+ *
526
+ * @param {Mixed} a
527
+ * @param {Mixed} b
528
+ * @return {Boolean} equal match
529
+ */
530
+
531
+ function sameValue(a, b) {
532
+ if (a === b) return a !== 0 || 1 / a === 1 / b;
533
+ return a !== a && b !== b;
534
+ }
535
+
536
+ /*!
537
+ * Compare the types of two given objects and
538
+ * return if they are equal. Note that an Array
539
+ * has a type of `array` (not `object`) and arguments
540
+ * have a type of `arguments` (not `array`/`object`).
541
+ *
542
+ * @param {Mixed} a
543
+ * @param {Mixed} b
544
+ * @return {Boolean} result
545
+ */
546
+
547
+ function typeEqual(a, b) {
548
+ return type(a) === type(b);
549
+ }
550
+
551
+ /*!
552
+ * Compare two Date objects by asserting that
553
+ * the time values are equal using `saveValue`.
554
+ *
555
+ * @param {Date} a
556
+ * @param {Date} b
557
+ * @return {Boolean} result
558
+ */
559
+
560
+ function dateEqual(a, b) {
561
+ if ('date' !== type(b)) return false;
562
+ return sameValue(a.getTime(), b.getTime());
563
+ }
564
+
565
+ /*!
566
+ * Compare two regular expressions by converting them
567
+ * to string and checking for `sameValue`.
568
+ *
569
+ * @param {RegExp} a
570
+ * @param {RegExp} b
571
+ * @return {Boolean} result
572
+ */
573
+
574
+ function regexpEqual(a, b) {
575
+ if ('regexp' !== type(b)) return false;
576
+ return sameValue(a.toString(), b.toString());
577
+ }
578
+
579
+ /*!
580
+ * Assert deep equality of two `arguments` objects.
581
+ * Unfortunately, these must be sliced to arrays
582
+ * prior to test to ensure no bad behavior.
583
+ *
584
+ * @param {Arguments} a
585
+ * @param {Arguments} b
586
+ * @param {Array} memoize (optional)
587
+ * @return {Boolean} result
588
+ */
589
+
590
+ function argumentsEqual(a, b, m) {
591
+ if ('arguments' !== type(b)) return false;
592
+ a = [].slice.call(a);
593
+ b = [].slice.call(b);
594
+ return deepEqual(a, b, m);
595
+ }
596
+
597
+ /*!
598
+ * Get enumerable properties of a given object.
599
+ *
600
+ * @param {Object} a
601
+ * @return {Array} property names
602
+ */
603
+
604
+ function enumerable(a) {
605
+ var res = [];
606
+ for (var key in a) res.push(key);
607
+ return res;
608
+ }
609
+
610
+ /*!
611
+ * Simple equality for flat iterable objects
612
+ * such as Arrays or Node.js buffers.
613
+ *
614
+ * @param {Iterable} a
615
+ * @param {Iterable} b
616
+ * @return {Boolean} result
617
+ */
618
+
619
+ function iterableEqual(a, b) {
620
+ if (a.length !== b.length) return false;
621
+
622
+ var i = 0;
623
+ var match = true;
624
+
625
+ for (; i < a.length; i++) {
626
+ if (a[i] !== b[i]) {
627
+ match = false;
628
+ break;
629
+ }
630
+ }
631
+
632
+ return match;
633
+ }
634
+
635
+ /*!
636
+ * Extension to `iterableEqual` specifically
637
+ * for Node.js Buffers.
638
+ *
639
+ * @param {Buffer} a
640
+ * @param {Mixed} b
641
+ * @return {Boolean} result
642
+ */
643
+
644
+ function bufferEqual(a, b) {
645
+ if (!Buffer.isBuffer(b)) return false;
646
+ return iterableEqual(a, b);
647
+ }
648
+
649
+ /*!
650
+ * Block for `objectEqual` ensuring non-existing
651
+ * values don't get in.
652
+ *
653
+ * @param {Mixed} object
654
+ * @return {Boolean} result
655
+ */
656
+
657
+ function isValue(a) {
658
+ return a !== null && a !== undefined;
659
+ }
660
+
661
+ /*!
662
+ * Recursively check the equality of two objects.
663
+ * Once basic sameness has been established it will
664
+ * defer to `deepEqual` for each enumerable key
665
+ * in the object.
666
+ *
667
+ * @param {Mixed} a
668
+ * @param {Mixed} b
669
+ * @return {Boolean} result
670
+ */
671
+
672
+ function objectEqual(a, b, m) {
673
+ if (!isValue(a) || !isValue(b)) {
674
+ return false;
675
+ }
676
+
677
+ if (a.prototype !== b.prototype) {
678
+ return false;
679
+ }
680
+
681
+ var i;
682
+ if (m) {
683
+ for (i = 0; i < m.length; i++) {
684
+ if ((m[i][0] === a && m[i][1] === b)
685
+ || (m[i][0] === b && m[i][1] === a)) {
686
+ return true;
687
+ }
688
+ }
689
+ } else {
690
+ m = [];
691
+ }
692
+
693
+ try {
694
+ var ka = enumerable(a);
695
+ var kb = enumerable(b);
696
+ } catch (ex) {
697
+ return false;
698
+ }
699
+
700
+ ka.sort();
701
+ kb.sort();
702
+
703
+ if (!iterableEqual(ka, kb)) {
704
+ return false;
705
+ }
706
+
707
+ m.push([ a, b ]);
708
+
709
+ var key;
710
+ for (i = ka.length - 1; i >= 0; i--) {
711
+ key = ka[i];
712
+ if (!deepEqual(a[key], b[key], m)) {
713
+ return false;
714
+ }
715
+ }
716
+
717
+ return true;
718
+ }
719
+
311
720
  });
312
721
  require.register("chai/index.js", function(exports, require, module){
313
722
  module.exports = require('./lib/chai');
@@ -316,7 +725,7 @@ module.exports = require('./lib/chai');
316
725
  require.register("chai/lib/chai.js", function(exports, require, module){
317
726
  /*!
318
727
  * chai
319
- * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>
728
+ * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
320
729
  * MIT Licensed
321
730
  */
322
731
 
@@ -327,7 +736,7 @@ var used = []
327
736
  * Chai version
328
737
  */
329
738
 
330
- exports.version = '1.7.2';
739
+ exports.version = '1.9.1';
331
740
 
332
741
  /*!
333
742
  * Assertion Error
@@ -360,6 +769,13 @@ exports.use = function (fn) {
360
769
  return this;
361
770
  };
362
771
 
772
+ /*!
773
+ * Configuration
774
+ */
775
+
776
+ var config = require('./chai/config');
777
+ exports.config = config;
778
+
363
779
  /*!
364
780
  * Primary `Assertion` prototype
365
781
  */
@@ -400,10 +816,12 @@ require.register("chai/lib/chai/assertion.js", function(exports, require, module
400
816
  /*!
401
817
  * chai
402
818
  * http://chaijs.com
403
- * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>
819
+ * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
404
820
  * MIT Licensed
405
821
  */
406
822
 
823
+ var config = require('./config');
824
+
407
825
  module.exports = function (_chai, util) {
408
826
  /*!
409
827
  * Module dependencies.
@@ -432,33 +850,27 @@ module.exports = function (_chai, util) {
432
850
  flag(this, 'message', msg);
433
851
  }
434
852
 
435
- /*!
436
- * ### Assertion.includeStack
437
- *
438
- * User configurable property, influences whether stack trace
439
- * is included in Assertion error message. Default of false
440
- * suppresses stack trace in the error message
441
- *
442
- * Assertion.includeStack = true; // enable stack on error
443
- *
444
- * @api public
445
- */
446
-
447
- Assertion.includeStack = false;
448
-
449
- /*!
450
- * ### Assertion.showDiff
451
- *
452
- * User configurable property, influences whether or not
453
- * the `showDiff` flag should be included in the thrown
454
- * AssertionErrors. `false` will always be `false`; `true`
455
- * will be true when the assertion has requested a diff
456
- * be shown.
457
- *
458
- * @api public
459
- */
853
+ Object.defineProperty(Assertion, 'includeStack', {
854
+ get: function() {
855
+ console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.');
856
+ return config.includeStack;
857
+ },
858
+ set: function(value) {
859
+ console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.');
860
+ config.includeStack = value;
861
+ }
862
+ });
460
863
 
461
- Assertion.showDiff = true;
864
+ Object.defineProperty(Assertion, 'showDiff', {
865
+ get: function() {
866
+ console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.');
867
+ return config.showDiff;
868
+ },
869
+ set: function(value) {
870
+ console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.');
871
+ config.showDiff = value;
872
+ }
873
+ });
462
874
 
463
875
  Assertion.addProperty = function (name, fn) {
464
876
  util.addProperty(this.prototype, name, fn);
@@ -480,6 +892,10 @@ module.exports = function (_chai, util) {
480
892
  util.overwriteMethod(this.prototype, name, fn);
481
893
  };
482
894
 
895
+ Assertion.overwriteChainableMethod = function (name, fn, chainingBehavior) {
896
+ util.overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);
897
+ };
898
+
483
899
  /*!
484
900
  * ### .assert(expression, message, negateMessage, expected, actual)
485
901
  *
@@ -497,7 +913,7 @@ module.exports = function (_chai, util) {
497
913
  Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) {
498
914
  var ok = util.test(this, arguments);
499
915
  if (true !== showDiff) showDiff = false;
500
- if (true !== Assertion.showDiff) showDiff = false;
916
+ if (true !== config.showDiff) showDiff = false;
501
917
 
502
918
  if (!ok) {
503
919
  var msg = util.getMessage(this, arguments)
@@ -506,7 +922,7 @@ module.exports = function (_chai, util) {
506
922
  actual: actual
507
923
  , expected: expected
508
924
  , showDiff: showDiff
509
- }, (Assertion.includeStack) ? this.assert : flag(this, 'ssfi'));
925
+ }, (config.includeStack) ? this.assert : flag(this, 'ssfi'));
510
926
  }
511
927
  };
512
928
 
@@ -528,12 +944,65 @@ module.exports = function (_chai, util) {
528
944
  });
529
945
  };
530
946
 
947
+ });
948
+ require.register("chai/lib/chai/config.js", function(exports, require, module){
949
+ module.exports = {
950
+
951
+ /**
952
+ * ### config.includeStack
953
+ *
954
+ * User configurable property, influences whether stack trace
955
+ * is included in Assertion error message. Default of false
956
+ * suppresses stack trace in the error message.
957
+ *
958
+ * chai.config.includeStack = true; // enable stack on error
959
+ *
960
+ * @param {Boolean}
961
+ * @api public
962
+ */
963
+
964
+ includeStack: false,
965
+
966
+ /**
967
+ * ### config.showDiff
968
+ *
969
+ * User configurable property, influences whether or not
970
+ * the `showDiff` flag should be included in the thrown
971
+ * AssertionErrors. `false` will always be `false`; `true`
972
+ * will be true when the assertion has requested a diff
973
+ * be shown.
974
+ *
975
+ * @param {Boolean}
976
+ * @api public
977
+ */
978
+
979
+ showDiff: true,
980
+
981
+ /**
982
+ * ### config.truncateThreshold
983
+ *
984
+ * User configurable property, sets length threshold for actual and
985
+ * expected values in assertion errors. If this threshold is exceeded,
986
+ * the value is truncated.
987
+ *
988
+ * Set it to zero if you want to disable truncating altogether.
989
+ *
990
+ * chai.config.truncateThreshold = 0; // disable truncating
991
+ *
992
+ * @param {Number}
993
+ * @api public
994
+ */
995
+
996
+ truncateThreshold: 40
997
+
998
+ };
999
+
531
1000
  });
532
1001
  require.register("chai/lib/chai/core/assertions.js", function(exports, require, module){
533
1002
  /*!
534
1003
  * chai
535
1004
  * http://chaijs.com
536
- * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>
1005
+ * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
537
1006
  * MIT Licensed
538
1007
  */
539
1008
 
@@ -545,9 +1014,9 @@ module.exports = function (chai, _) {
545
1014
  /**
546
1015
  * ### Language Chains
547
1016
  *
548
- * The following are provide as chainable getters to
1017
+ * The following are provided as chainable getters to
549
1018
  * improve the readability of your assertions. They
550
- * do not provide an testing capability unless they
1019
+ * do not provide testing capabilities unless they
551
1020
  * have been overwritten by a plugin.
552
1021
  *
553
1022
  * **Chains**
@@ -558,6 +1027,7 @@ module.exports = function (chai, _) {
558
1027
  * - is
559
1028
  * - that
560
1029
  * - and
1030
+ * - has
561
1031
  * - have
562
1032
  * - with
563
1033
  * - at
@@ -569,7 +1039,7 @@ module.exports = function (chai, _) {
569
1039
  */
570
1040
 
571
1041
  [ 'to', 'be', 'been'
572
- , 'is', 'and', 'have'
1042
+ , 'is', 'and', 'has', 'have'
573
1043
  , 'with', 'that', 'at'
574
1044
  , 'of', 'same' ].forEach(function (chain) {
575
1045
  Assertion.addProperty(chain, function () {
@@ -677,9 +1147,28 @@ module.exports = function (chai, _) {
677
1147
 
678
1148
  function include (val, msg) {
679
1149
  if (msg) flag(this, 'message', msg);
680
- var obj = flag(this, 'object')
1150
+ var obj = flag(this, 'object');
1151
+ var expected = false;
1152
+ if (_.type(obj) === 'array' && _.type(val) === 'object') {
1153
+ for (var i in obj) {
1154
+ if (_.eql(obj[i], val)) {
1155
+ expected = true;
1156
+ break;
1157
+ }
1158
+ }
1159
+ } else if (_.type(val) === 'object') {
1160
+ if (!flag(this, 'negate')) {
1161
+ for (var k in val) new Assertion(obj).property(k, val[k]);
1162
+ return;
1163
+ }
1164
+ var subset = {}
1165
+ for (var k in val) subset[k] = obj[k]
1166
+ expected = _.eql(subset, val);
1167
+ } else {
1168
+ expected = obj && ~obj.indexOf(val)
1169
+ }
681
1170
  this.assert(
682
- ~obj.indexOf(val)
1171
+ expected
683
1172
  , 'expected #{this} to include ' + _.inspect(val)
684
1173
  , 'expected #{this} to not include ' + _.inspect(val));
685
1174
  }
@@ -776,8 +1265,8 @@ module.exports = function (chai, _) {
776
1265
  *
777
1266
  * Asserts that the target is `undefined`.
778
1267
  *
779
- * expect(undefined).to.be.undefined;
780
- * expect(null).to.not.be.undefined;
1268
+ * expect(undefined).to.be.undefined;
1269
+ * expect(null).to.not.be.undefined;
781
1270
  *
782
1271
  * @name undefined
783
1272
  * @api public
@@ -1534,6 +2023,7 @@ module.exports = function (chai, _) {
1534
2023
  * @param {String|RegExp} expected error message
1535
2024
  * @param {String} message _optional_
1536
2025
  * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
2026
+ * @returns error for chaining (null if no error)
1537
2027
  * @api public
1538
2028
  */
1539
2029
 
@@ -1558,7 +2048,10 @@ module.exports = function (chai, _) {
1558
2048
  constructor = null;
1559
2049
  errMsg = null;
1560
2050
  } else if (typeof constructor === 'function') {
1561
- name = (new constructor()).name;
2051
+ name = constructor.prototype.name || constructor.name;
2052
+ if (name === 'Error' && constructor !== Error) {
2053
+ name = (new constructor()).name;
2054
+ }
1562
2055
  } else {
1563
2056
  constructor = null;
1564
2057
  }
@@ -1572,12 +2065,14 @@ module.exports = function (chai, _) {
1572
2065
  err === desiredError
1573
2066
  , 'expected #{this} to throw #{exp} but #{act} was thrown'
1574
2067
  , 'expected #{this} to not throw #{exp}'
1575
- , desiredError
1576
- , err
2068
+ , (desiredError instanceof Error ? desiredError.toString() : desiredError)
2069
+ , (err instanceof Error ? err.toString() : err)
1577
2070
  );
1578
2071
 
2072
+ flag(this, 'object', err);
1579
2073
  return this;
1580
2074
  }
2075
+
1581
2076
  // next, check constructor
1582
2077
  if (constructor) {
1583
2078
  this.assert(
@@ -1585,11 +2080,15 @@ module.exports = function (chai, _) {
1585
2080
  , 'expected #{this} to throw #{exp} but #{act} was thrown'
1586
2081
  , 'expected #{this} to not throw #{exp} but #{act} was thrown'
1587
2082
  , name
1588
- , err
2083
+ , (err instanceof Error ? err.toString() : err)
1589
2084
  );
1590
2085
 
1591
- if (!errMsg) return this;
2086
+ if (!errMsg) {
2087
+ flag(this, 'object', err);
2088
+ return this;
2089
+ }
1592
2090
  }
2091
+
1593
2092
  // next, check message
1594
2093
  var message = 'object' === _.type(err) && "message" in err
1595
2094
  ? err.message
@@ -1604,6 +2103,7 @@ module.exports = function (chai, _) {
1604
2103
  , message
1605
2104
  );
1606
2105
 
2106
+ flag(this, 'object', err);
1607
2107
  return this;
1608
2108
  } else if ((message != null) && errMsg && 'string' === typeof errMsg) {
1609
2109
  this.assert(
@@ -1614,6 +2114,7 @@ module.exports = function (chai, _) {
1614
2114
  , message
1615
2115
  );
1616
2116
 
2117
+ flag(this, 'object', err);
1617
2118
  return this;
1618
2119
  } else {
1619
2120
  thrown = true;
@@ -1636,9 +2137,11 @@ module.exports = function (chai, _) {
1636
2137
  thrown === true
1637
2138
  , 'expected #{this} to throw ' + expectedThrown + actuallyGot
1638
2139
  , 'expected #{this} to not throw ' + expectedThrown + actuallyGot
1639
- , desiredError
1640
- , thrownError
2140
+ , (desiredError instanceof Error ? desiredError.toString() : desiredError)
2141
+ , (thrownError instanceof Error ? thrownError.toString() : thrownError)
1641
2142
  );
2143
+
2144
+ flag(this, 'object', thrownError);
1642
2145
  };
1643
2146
 
1644
2147
  Assertion.addMethod('throw', assertThrows);
@@ -1657,8 +2160,8 @@ module.exports = function (chai, _) {
1657
2160
  * To check if a constructor will respond to a static function,
1658
2161
  * set the `itself` flag.
1659
2162
  *
1660
- * Klass.baz = function(){};
1661
- * expect(Klass).itself.to.respondTo('baz');
2163
+ * Klass.baz = function(){};
2164
+ * expect(Klass).itself.to.respondTo('baz');
1662
2165
  *
1663
2166
  * @name respondTo
1664
2167
  * @param {String} method
@@ -1686,12 +2189,12 @@ module.exports = function (chai, _) {
1686
2189
  *
1687
2190
  * Sets the `itself` flag, later used by the `respondTo` assertion.
1688
2191
  *
1689
- * function Foo() {}
1690
- * Foo.bar = function() {}
1691
- * Foo.prototype.baz = function() {}
2192
+ * function Foo() {}
2193
+ * Foo.bar = function() {}
2194
+ * Foo.prototype.baz = function() {}
1692
2195
  *
1693
- * expect(Foo).itself.to.respondTo('bar');
1694
- * expect(Foo).itself.not.to.respondTo('baz');
2196
+ * expect(Foo).itself.to.respondTo('bar');
2197
+ * expect(Foo).itself.not.to.respondTo('baz');
1695
2198
  *
1696
2199
  * @name itself
1697
2200
  * @api public
@@ -1750,9 +2253,13 @@ module.exports = function (chai, _) {
1750
2253
  );
1751
2254
  });
1752
2255
 
1753
- function isSubsetOf(subset, superset) {
2256
+ function isSubsetOf(subset, superset, cmp) {
1754
2257
  return subset.every(function(elem) {
1755
- return superset.indexOf(elem) !== -1;
2258
+ if (!cmp) return superset.indexOf(elem) !== -1;
2259
+
2260
+ return superset.some(function(elem2) {
2261
+ return cmp(elem, elem2);
2262
+ });
1756
2263
  })
1757
2264
  }
1758
2265
 
@@ -1760,7 +2267,9 @@ module.exports = function (chai, _) {
1760
2267
  * ### .members(set)
1761
2268
  *
1762
2269
  * Asserts that the target is a superset of `set`,
1763
- * or that the target and `set` have the same members.
2270
+ * or that the target and `set` have the same strictly-equal (===) members.
2271
+ * Alternately, if the `deep` flag is set, set members are compared for deep
2272
+ * equality.
1764
2273
  *
1765
2274
  * expect([1, 2, 3]).to.include.members([3, 2]);
1766
2275
  * expect([1, 2, 3]).to.not.include.members([3, 2, 8]);
@@ -1768,6 +2277,8 @@ module.exports = function (chai, _) {
1768
2277
  * expect([4, 2]).to.have.members([2, 4]);
1769
2278
  * expect([5, 2]).to.not.have.members([5, 2, 1]);
1770
2279
  *
2280
+ * expect([{ id: 1 }]).to.deep.include.members([{ id: 1 }]);
2281
+ *
1771
2282
  * @name members
1772
2283
  * @param {Array} set
1773
2284
  * @param {String} message _optional_
@@ -1781,9 +2292,11 @@ module.exports = function (chai, _) {
1781
2292
  new Assertion(obj).to.be.an('array');
1782
2293
  new Assertion(subset).to.be.an('array');
1783
2294
 
2295
+ var cmp = flag(this, 'deep') ? _.eql : undefined;
2296
+
1784
2297
  if (flag(this, 'contains')) {
1785
2298
  return this.assert(
1786
- isSubsetOf(subset, obj)
2299
+ isSubsetOf(subset, obj, cmp)
1787
2300
  , 'expected #{this} to be a superset of #{act}'
1788
2301
  , 'expected #{this} to not be a superset of #{act}'
1789
2302
  , obj
@@ -1792,7 +2305,7 @@ module.exports = function (chai, _) {
1792
2305
  }
1793
2306
 
1794
2307
  this.assert(
1795
- isSubsetOf(obj, subset) && isSubsetOf(subset, obj)
2308
+ isSubsetOf(obj, subset, cmp) && isSubsetOf(subset, obj, cmp)
1796
2309
  , 'expected #{this} to have the same members as #{act}'
1797
2310
  , 'expected #{this} to not have the same members as #{act}'
1798
2311
  , obj
@@ -1805,7 +2318,7 @@ module.exports = function (chai, _) {
1805
2318
  require.register("chai/lib/chai/interface/assert.js", function(exports, require, module){
1806
2319
  /*!
1807
2320
  * chai
1808
- * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>
2321
+ * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
1809
2322
  * MIT Licensed
1810
2323
  */
1811
2324
 
@@ -1838,7 +2351,7 @@ module.exports = function (chai, util) {
1838
2351
  */
1839
2352
 
1840
2353
  var assert = chai.assert = function (express, errmsg) {
1841
- var test = new Assertion(null);
2354
+ var test = new Assertion(null, null, chai.assert);
1842
2355
  test.assert(
1843
2356
  express
1844
2357
  , errmsg
@@ -1860,13 +2373,12 @@ module.exports = function (chai, util) {
1860
2373
  */
1861
2374
 
1862
2375
  assert.fail = function (actual, expected, message, operator) {
1863
- throw new chai.AssertionError({
2376
+ message = message || 'assert.fail()';
2377
+ throw new chai.AssertionError(message, {
1864
2378
  actual: actual
1865
2379
  , expected: expected
1866
- , message: message
1867
2380
  , operator: operator
1868
- , stackStartFunction: assert.fail
1869
- });
2381
+ }, assert.fail);
1870
2382
  };
1871
2383
 
1872
2384
  /**
@@ -1920,7 +2432,7 @@ module.exports = function (chai, util) {
1920
2432
  */
1921
2433
 
1922
2434
  assert.equal = function (act, exp, msg) {
1923
- var test = new Assertion(act, msg);
2435
+ var test = new Assertion(act, msg, assert.equal);
1924
2436
 
1925
2437
  test.assert(
1926
2438
  exp == flag(test, 'object')
@@ -1946,7 +2458,7 @@ module.exports = function (chai, util) {
1946
2458
  */
1947
2459
 
1948
2460
  assert.notEqual = function (act, exp, msg) {
1949
- var test = new Assertion(act, msg);
2461
+ var test = new Assertion(act, msg, assert.notEqual);
1950
2462
 
1951
2463
  test.assert(
1952
2464
  exp != flag(test, 'object')
@@ -2197,8 +2709,8 @@ module.exports = function (chai, util) {
2197
2709
  * Asserts that `value` is _not_ an object.
2198
2710
  *
2199
2711
  * var selection = 'chai'
2200
- * assert.isObject(selection, 'tea selection is not an object');
2201
- * assert.isObject(null, 'null is not an object');
2712
+ * assert.isNotObject(selection, 'tea selection is not an object');
2713
+ * assert.isNotObject(null, 'null is not an object');
2202
2714
  *
2203
2715
  * @name isNotObject
2204
2716
  * @param {Mixed} value
@@ -2462,19 +2974,7 @@ module.exports = function (chai, util) {
2462
2974
  */
2463
2975
 
2464
2976
  assert.include = function (exp, inc, msg) {
2465
- var obj = new Assertion(exp, msg);
2466
-
2467
- if (Array.isArray(exp)) {
2468
- obj.to.include(inc);
2469
- } else if ('string' === typeof exp) {
2470
- obj.to.contain.string(inc);
2471
- } else {
2472
- throw new chai.AssertionError(
2473
- 'expected an array or string'
2474
- , null
2475
- , assert.include
2476
- );
2477
- }
2977
+ new Assertion(exp, msg, assert.include).include(inc);
2478
2978
  };
2479
2979
 
2480
2980
  /**
@@ -2494,19 +2994,7 @@ module.exports = function (chai, util) {
2494
2994
  */
2495
2995
 
2496
2996
  assert.notInclude = function (exp, inc, msg) {
2497
- var obj = new Assertion(exp, msg);
2498
-
2499
- if (Array.isArray(exp)) {
2500
- obj.to.not.include(inc);
2501
- } else if ('string' === typeof exp) {
2502
- obj.to.not.contain.string(inc);
2503
- } else {
2504
- throw new chai.AssertionError(
2505
- 'expected an array or string'
2506
- , null
2507
- , assert.notInclude
2508
- );
2509
- }
2997
+ new Assertion(exp, msg, assert.notInclude).not.include(inc);
2510
2998
  };
2511
2999
 
2512
3000
  /**
@@ -2750,7 +3238,8 @@ module.exports = function (chai, util) {
2750
3238
  errt = null;
2751
3239
  }
2752
3240
 
2753
- new Assertion(fn, msg).to.Throw(errt, errs);
3241
+ var assertErr = new Assertion(fn, msg).to.Throw(errt, errs);
3242
+ return flag(assertErr, 'object');
2754
3243
  };
2755
3244
 
2756
3245
  /**
@@ -2888,7 +3377,7 @@ module.exports = function (chai, util) {
2888
3377
  require.register("chai/lib/chai/interface/expect.js", function(exports, require, module){
2889
3378
  /*!
2890
3379
  * chai
2891
- * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>
3380
+ * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
2892
3381
  * MIT Licensed
2893
3382
  */
2894
3383
 
@@ -2903,7 +3392,7 @@ module.exports = function (chai, util) {
2903
3392
  require.register("chai/lib/chai/interface/should.js", function(exports, require, module){
2904
3393
  /*!
2905
3394
  * chai
2906
- * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>
3395
+ * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
2907
3396
  * MIT Licensed
2908
3397
  */
2909
3398
 
@@ -2911,31 +3400,33 @@ module.exports = function (chai, util) {
2911
3400
  var Assertion = chai.Assertion;
2912
3401
 
2913
3402
  function loadShould () {
3403
+ // explicitly define this method as function as to have it's name to include as `ssfi`
3404
+ function shouldGetter() {
3405
+ if (this instanceof String || this instanceof Number) {
3406
+ return new Assertion(this.constructor(this), null, shouldGetter);
3407
+ } else if (this instanceof Boolean) {
3408
+ return new Assertion(this == true, null, shouldGetter);
3409
+ }
3410
+ return new Assertion(this, null, shouldGetter);
3411
+ }
3412
+ function shouldSetter(value) {
3413
+ // See https://github.com/chaijs/chai/issues/86: this makes
3414
+ // `whatever.should = someValue` actually set `someValue`, which is
3415
+ // especially useful for `global.should = require('chai').should()`.
3416
+ //
3417
+ // Note that we have to use [[DefineProperty]] instead of [[Put]]
3418
+ // since otherwise we would trigger this very setter!
3419
+ Object.defineProperty(this, 'should', {
3420
+ value: value,
3421
+ enumerable: true,
3422
+ configurable: true,
3423
+ writable: true
3424
+ });
3425
+ }
2914
3426
  // modify Object.prototype to have `should`
2915
- Object.defineProperty(Object.prototype, 'should',
2916
- {
2917
- set: function (value) {
2918
- // See https://github.com/chaijs/chai/issues/86: this makes
2919
- // `whatever.should = someValue` actually set `someValue`, which is
2920
- // especially useful for `global.should = require('chai').should()`.
2921
- //
2922
- // Note that we have to use [[DefineProperty]] instead of [[Put]]
2923
- // since otherwise we would trigger this very setter!
2924
- Object.defineProperty(this, 'should', {
2925
- value: value,
2926
- enumerable: true,
2927
- configurable: true,
2928
- writable: true
2929
- });
2930
- }
2931
- , get: function(){
2932
- if (this instanceof String || this instanceof Number) {
2933
- return new Assertion(this.constructor(this));
2934
- } else if (this instanceof Boolean) {
2935
- return new Assertion(this == true);
2936
- }
2937
- return new Assertion(this);
2938
- }
3427
+ Object.defineProperty(Object.prototype, 'should', {
3428
+ set: shouldSetter
3429
+ , get: shouldGetter
2939
3430
  , configurable: true
2940
3431
  });
2941
3432
 
@@ -2982,7 +3473,7 @@ module.exports = function (chai, util) {
2982
3473
  require.register("chai/lib/chai/utils/addChainableMethod.js", function(exports, require, module){
2983
3474
  /*!
2984
3475
  * Chai - addChainingMethod utility
2985
- * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
3476
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
2986
3477
  * MIT Licensed
2987
3478
  */
2988
3479
 
@@ -2991,6 +3482,8 @@ require.register("chai/lib/chai/utils/addChainableMethod.js", function(exports,
2991
3482
  */
2992
3483
 
2993
3484
  var transferFlags = require('./transferFlags');
3485
+ var flag = require('./flag');
3486
+ var config = require('../config');
2994
3487
 
2995
3488
  /*!
2996
3489
  * Module variables
@@ -3037,15 +3530,30 @@ var call = Function.prototype.call,
3037
3530
  */
3038
3531
 
3039
3532
  module.exports = function (ctx, name, method, chainingBehavior) {
3040
- if (typeof chainingBehavior !== 'function')
3533
+ if (typeof chainingBehavior !== 'function') {
3041
3534
  chainingBehavior = function () { };
3535
+ }
3536
+
3537
+ var chainableBehavior = {
3538
+ method: method
3539
+ , chainingBehavior: chainingBehavior
3540
+ };
3541
+
3542
+ // save the methods so we can overwrite them later, if we need to.
3543
+ if (!ctx.__methods) {
3544
+ ctx.__methods = {};
3545
+ }
3546
+ ctx.__methods[name] = chainableBehavior;
3042
3547
 
3043
3548
  Object.defineProperty(ctx, name,
3044
3549
  { get: function () {
3045
- chainingBehavior.call(this);
3550
+ chainableBehavior.chainingBehavior.call(this);
3046
3551
 
3047
- var assert = function () {
3048
- var result = method.apply(this, arguments);
3552
+ var assert = function assert() {
3553
+ var old_ssfi = flag(this, 'ssfi');
3554
+ if (old_ssfi && config.includeStack === false)
3555
+ flag(this, 'ssfi', assert);
3556
+ var result = chainableBehavior.method.apply(this, arguments);
3049
3557
  return result === undefined ? this : result;
3050
3558
  };
3051
3559
 
@@ -3079,10 +3587,12 @@ module.exports = function (ctx, name, method, chainingBehavior) {
3079
3587
  require.register("chai/lib/chai/utils/addMethod.js", function(exports, require, module){
3080
3588
  /*!
3081
3589
  * Chai - addMethod utility
3082
- * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
3590
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3083
3591
  * MIT Licensed
3084
3592
  */
3085
3593
 
3594
+ var config = require('../config');
3595
+
3086
3596
  /**
3087
3597
  * ### .addMethod (ctx, name, method)
3088
3598
  *
@@ -3107,9 +3617,13 @@ require.register("chai/lib/chai/utils/addMethod.js", function(exports, require,
3107
3617
  * @name addMethod
3108
3618
  * @api public
3109
3619
  */
3620
+ var flag = require('./flag');
3110
3621
 
3111
3622
  module.exports = function (ctx, name, method) {
3112
3623
  ctx[name] = function () {
3624
+ var old_ssfi = flag(this, 'ssfi');
3625
+ if (old_ssfi && config.includeStack === false)
3626
+ flag(this, 'ssfi', ctx[name]);
3113
3627
  var result = method.apply(this, arguments);
3114
3628
  return result === undefined ? this : result;
3115
3629
  };
@@ -3119,7 +3633,7 @@ module.exports = function (ctx, name, method) {
3119
3633
  require.register("chai/lib/chai/utils/addProperty.js", function(exports, require, module){
3120
3634
  /*!
3121
3635
  * Chai - addProperty utility
3122
- * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
3636
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3123
3637
  * MIT Licensed
3124
3638
  */
3125
3639
 
@@ -3158,143 +3672,11 @@ module.exports = function (ctx, name, getter) {
3158
3672
  });
3159
3673
  };
3160
3674
 
3161
- });
3162
- require.register("chai/lib/chai/utils/eql.js", function(exports, require, module){
3163
- // This is (almost) directly from Node.js assert
3164
- // https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/assert.js
3165
-
3166
- module.exports = _deepEqual;
3167
-
3168
- var getEnumerableProperties = require('./getEnumerableProperties');
3169
-
3170
- // for the browser
3171
- var Buffer;
3172
- try {
3173
- Buffer = require('buffer').Buffer;
3174
- } catch (ex) {
3175
- Buffer = {
3176
- isBuffer: function () { return false; }
3177
- };
3178
- }
3179
-
3180
- function _deepEqual(actual, expected, memos) {
3181
-
3182
- // 7.1. All identical values are equivalent, as determined by ===.
3183
- if (actual === expected) {
3184
- return true;
3185
-
3186
- } else if (Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) {
3187
- if (actual.length != expected.length) return false;
3188
-
3189
- for (var i = 0; i < actual.length; i++) {
3190
- if (actual[i] !== expected[i]) return false;
3191
- }
3192
-
3193
- return true;
3194
-
3195
- // 7.2. If the expected value is a Date object, the actual value is
3196
- // equivalent if it is also a Date object that refers to the same time.
3197
- } else if (expected instanceof Date) {
3198
- if (!(actual instanceof Date)) return false;
3199
- return actual.getTime() === expected.getTime();
3200
-
3201
- // 7.3. Other pairs that do not both pass typeof value == 'object',
3202
- // equivalence is determined by ==.
3203
- } else if (typeof actual != 'object' && typeof expected != 'object') {
3204
- return actual === expected;
3205
-
3206
- } else if (expected instanceof RegExp) {
3207
- if (!(actual instanceof RegExp)) return false;
3208
- return actual.toString() === expected.toString();
3209
-
3210
- // 7.4. For all other Object pairs, including Array objects, equivalence is
3211
- // determined by having the same number of owned properties (as verified
3212
- // with Object.prototype.hasOwnProperty.call), the same set of keys
3213
- // (although not necessarily the same order), equivalent values for every
3214
- // corresponding key, and an identical 'prototype' property. Note: this
3215
- // accounts for both named and indexed properties on Arrays.
3216
- } else {
3217
- return objEquiv(actual, expected, memos);
3218
- }
3219
- }
3220
-
3221
- function isUndefinedOrNull(value) {
3222
- return value === null || value === undefined;
3223
- }
3224
-
3225
- function isArguments(object) {
3226
- return Object.prototype.toString.call(object) == '[object Arguments]';
3227
- }
3228
-
3229
- function objEquiv(a, b, memos) {
3230
- if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
3231
- return false;
3232
-
3233
- // an identical 'prototype' property.
3234
- if (a.prototype !== b.prototype) return false;
3235
-
3236
- // check if we have already compared a and b
3237
- var i;
3238
- if (memos) {
3239
- for(i = 0; i < memos.length; i++) {
3240
- if ((memos[i][0] === a && memos[i][1] === b) ||
3241
- (memos[i][0] === b && memos[i][1] === a))
3242
- return true;
3243
- }
3244
- } else {
3245
- memos = [];
3246
- }
3247
-
3248
- //~~~I've managed to break Object.keys through screwy arguments passing.
3249
- // Converting to array solves the problem.
3250
- if (isArguments(a)) {
3251
- if (!isArguments(b)) {
3252
- return false;
3253
- }
3254
- a = pSlice.call(a);
3255
- b = pSlice.call(b);
3256
- return _deepEqual(a, b, memos);
3257
- }
3258
- try {
3259
- var ka = getEnumerableProperties(a),
3260
- kb = getEnumerableProperties(b),
3261
- key;
3262
- } catch (e) {//happens when one is a string literal and the other isn't
3263
- return false;
3264
- }
3265
-
3266
- // having the same number of owned properties (keys incorporates
3267
- // hasOwnProperty)
3268
- if (ka.length != kb.length)
3269
- return false;
3270
-
3271
- //the same set of keys (although not necessarily the same order),
3272
- ka.sort();
3273
- kb.sort();
3274
- //~~~cheap key test
3275
- for (i = ka.length - 1; i >= 0; i--) {
3276
- if (ka[i] != kb[i])
3277
- return false;
3278
- }
3279
-
3280
- // remember objects we have compared to guard against circular references
3281
- memos.push([ a, b ]);
3282
-
3283
- //equivalent values for every corresponding key, and
3284
- //~~~possibly expensive deep test
3285
- for (i = ka.length - 1; i >= 0; i--) {
3286
- key = ka[i];
3287
- if (!_deepEqual(a[key], b[key], memos)) return false;
3288
- }
3289
-
3290
- return true;
3291
- }
3292
-
3293
3675
  });
3294
3676
  require.register("chai/lib/chai/utils/flag.js", function(exports, require, module){
3295
3677
  /*!
3296
3678
  * Chai - flag utility
3297
- * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
3679
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3298
3680
  * MIT Licensed
3299
3681
  */
3300
3682
 
@@ -3329,7 +3711,7 @@ module.exports = function (obj, key, value) {
3329
3711
  require.register("chai/lib/chai/utils/getActual.js", function(exports, require, module){
3330
3712
  /*!
3331
3713
  * Chai - getActual utility
3332
- * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
3714
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3333
3715
  * MIT Licensed
3334
3716
  */
3335
3717
 
@@ -3343,15 +3725,14 @@ require.register("chai/lib/chai/utils/getActual.js", function(exports, require,
3343
3725
  */
3344
3726
 
3345
3727
  module.exports = function (obj, args) {
3346
- var actual = args[4];
3347
- return 'undefined' !== typeof actual ? actual : obj._obj;
3728
+ return args.length > 4 ? args[4] : obj._obj;
3348
3729
  };
3349
3730
 
3350
3731
  });
3351
3732
  require.register("chai/lib/chai/utils/getEnumerableProperties.js", function(exports, require, module){
3352
3733
  /*!
3353
3734
  * Chai - getEnumerableProperties utility
3354
- * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
3735
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3355
3736
  * MIT Licensed
3356
3737
  */
3357
3738
 
@@ -3379,7 +3760,7 @@ module.exports = function getEnumerableProperties(object) {
3379
3760
  require.register("chai/lib/chai/utils/getMessage.js", function(exports, require, module){
3380
3761
  /*!
3381
3762
  * Chai - message composition utility
3382
- * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
3763
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3383
3764
  * MIT Licensed
3384
3765
  */
3385
3766
 
@@ -3431,7 +3812,7 @@ module.exports = function (obj, args) {
3431
3812
  require.register("chai/lib/chai/utils/getName.js", function(exports, require, module){
3432
3813
  /*!
3433
3814
  * Chai - getName utility
3434
- * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
3815
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3435
3816
  * MIT Licensed
3436
3817
  */
3437
3818
 
@@ -3454,7 +3835,7 @@ module.exports = function (func) {
3454
3835
  require.register("chai/lib/chai/utils/getPathValue.js", function(exports, require, module){
3455
3836
  /*!
3456
3837
  * Chai - getPathValue utility
3457
- * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
3838
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3458
3839
  * @see https://github.com/logicalparadox/filtr
3459
3840
  * MIT Licensed
3460
3841
  */
@@ -3559,7 +3940,7 @@ function _getPathValue (parsed, obj) {
3559
3940
  require.register("chai/lib/chai/utils/getProperties.js", function(exports, require, module){
3560
3941
  /*!
3561
3942
  * Chai - getProperties utility
3562
- * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
3943
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3563
3944
  * MIT Licensed
3564
3945
  */
3565
3946
 
@@ -3659,7 +4040,7 @@ exports.transferFlags = require('./transferFlags');
3659
4040
  * Deep equal utility
3660
4041
  */
3661
4042
 
3662
- exports.eql = require('./eql');
4043
+ exports.eql = require('deep-eql');
3663
4044
 
3664
4045
  /*!
3665
4046
  * Deep path value
@@ -3703,6 +4084,12 @@ exports.overwriteMethod = require('./overwriteMethod');
3703
4084
 
3704
4085
  exports.addChainableMethod = require('./addChainableMethod');
3705
4086
 
4087
+ /*!
4088
+ * Overwrite chainable method
4089
+ */
4090
+
4091
+ exports.overwriteChainableMethod = require('./overwriteChainableMethod');
4092
+
3706
4093
 
3707
4094
  });
3708
4095
  require.register("chai/lib/chai/utils/inspect.js", function(exports, require, module){
@@ -4031,7 +4418,7 @@ function objectToString(o) {
4031
4418
  require.register("chai/lib/chai/utils/objDisplay.js", function(exports, require, module){
4032
4419
  /*!
4033
4420
  * Chai - flag utility
4034
- * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4421
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4035
4422
  * MIT Licensed
4036
4423
  */
4037
4424
 
@@ -4040,6 +4427,7 @@ require.register("chai/lib/chai/utils/objDisplay.js", function(exports, require,
4040
4427
  */
4041
4428
 
4042
4429
  var inspect = require('./inspect');
4430
+ var config = require('../config');
4043
4431
 
4044
4432
  /**
4045
4433
  * ### .objDisplay (object)
@@ -4057,7 +4445,7 @@ module.exports = function (obj) {
4057
4445
  var str = inspect(obj)
4058
4446
  , type = Object.prototype.toString.call(obj);
4059
4447
 
4060
- if (str.length >= 40) {
4448
+ if (config.truncateThreshold && str.length >= config.truncateThreshold) {
4061
4449
  if (type === '[object Function]') {
4062
4450
  return !obj.name || obj.name === ''
4063
4451
  ? '[Function]'
@@ -4082,7 +4470,7 @@ module.exports = function (obj) {
4082
4470
  require.register("chai/lib/chai/utils/overwriteMethod.js", function(exports, require, module){
4083
4471
  /*!
4084
4472
  * Chai - overwriteMethod utility
4085
- * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4473
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4086
4474
  * MIT Licensed
4087
4475
  */
4088
4476
 
@@ -4136,7 +4524,7 @@ module.exports = function (ctx, name, method) {
4136
4524
  require.register("chai/lib/chai/utils/overwriteProperty.js", function(exports, require, module){
4137
4525
  /*!
4138
4526
  * Chai - overwriteProperty utility
4139
- * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4527
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4140
4528
  * MIT Licensed
4141
4529
  */
4142
4530
 
@@ -4189,11 +4577,67 @@ module.exports = function (ctx, name, getter) {
4189
4577
  });
4190
4578
  };
4191
4579
 
4580
+ });
4581
+ require.register("chai/lib/chai/utils/overwriteChainableMethod.js", function(exports, require, module){
4582
+ /*!
4583
+ * Chai - overwriteChainableMethod utility
4584
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4585
+ * MIT Licensed
4586
+ */
4587
+
4588
+ /**
4589
+ * ### overwriteChainableMethod (ctx, name, fn)
4590
+ *
4591
+ * Overwites an already existing chainable method
4592
+ * and provides access to the previous function or
4593
+ * property. Must return functions to be used for
4594
+ * name.
4595
+ *
4596
+ * utils.overwriteChainableMethod(chai.Assertion.prototype, 'length',
4597
+ * function (_super) {
4598
+ * }
4599
+ * , function (_super) {
4600
+ * }
4601
+ * );
4602
+ *
4603
+ * Can also be accessed directly from `chai.Assertion`.
4604
+ *
4605
+ * chai.Assertion.overwriteChainableMethod('foo', fn, fn);
4606
+ *
4607
+ * Then can be used as any other assertion.
4608
+ *
4609
+ * expect(myFoo).to.have.length(3);
4610
+ * expect(myFoo).to.have.length.above(3);
4611
+ *
4612
+ * @param {Object} ctx object whose method / property is to be overwritten
4613
+ * @param {String} name of method / property to overwrite
4614
+ * @param {Function} method function that returns a function to be used for name
4615
+ * @param {Function} chainingBehavior function that returns a function to be used for property
4616
+ * @name overwriteChainableMethod
4617
+ * @api public
4618
+ */
4619
+
4620
+ module.exports = function (ctx, name, method, chainingBehavior) {
4621
+ var chainableBehavior = ctx.__methods[name];
4622
+
4623
+ var _chainingBehavior = chainableBehavior.chainingBehavior;
4624
+ chainableBehavior.chainingBehavior = function () {
4625
+ var result = chainingBehavior(_chainingBehavior).call(this);
4626
+ return result === undefined ? this : result;
4627
+ };
4628
+
4629
+ var _method = chainableBehavior.method;
4630
+ chainableBehavior.method = function () {
4631
+ var result = method(_method).apply(this, arguments);
4632
+ return result === undefined ? this : result;
4633
+ };
4634
+ };
4635
+
4192
4636
  });
4193
4637
  require.register("chai/lib/chai/utils/test.js", function(exports, require, module){
4194
4638
  /*!
4195
4639
  * Chai - test utility
4196
- * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4640
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4197
4641
  * MIT Licensed
4198
4642
  */
4199
4643
 
@@ -4222,7 +4666,7 @@ module.exports = function (obj, args) {
4222
4666
  require.register("chai/lib/chai/utils/transferFlags.js", function(exports, require, module){
4223
4667
  /*!
4224
4668
  * Chai - transferFlags utility
4225
- * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4669
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4226
4670
  * MIT Licensed
4227
4671
  */
4228
4672
 
@@ -4269,7 +4713,7 @@ module.exports = function (assertion, object, includeAll) {
4269
4713
  require.register("chai/lib/chai/utils/type.js", function(exports, require, module){
4270
4714
  /*!
4271
4715
  * Chai - type utility
4272
- * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4716
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4273
4717
  * MIT Licensed
4274
4718
  */
4275
4719
 
@@ -4314,17 +4758,25 @@ module.exports = function (obj) {
4314
4758
  };
4315
4759
 
4316
4760
  });
4761
+
4762
+
4763
+
4764
+
4317
4765
  require.alias("chaijs-assertion-error/index.js", "chai/deps/assertion-error/index.js");
4318
4766
  require.alias("chaijs-assertion-error/index.js", "chai/deps/assertion-error/index.js");
4319
4767
  require.alias("chaijs-assertion-error/index.js", "assertion-error/index.js");
4320
4768
  require.alias("chaijs-assertion-error/index.js", "chaijs-assertion-error/index.js");
4321
-
4322
- require.alias("chai/index.js", "chai/index.js");
4323
-
4324
- if (typeof exports == "object") {
4769
+ require.alias("chaijs-deep-eql/lib/eql.js", "chai/deps/deep-eql/lib/eql.js");
4770
+ require.alias("chaijs-deep-eql/lib/eql.js", "chai/deps/deep-eql/index.js");
4771
+ require.alias("chaijs-deep-eql/lib/eql.js", "deep-eql/index.js");
4772
+ require.alias("chaijs-type-detect/lib/type.js", "chaijs-deep-eql/deps/type-detect/lib/type.js");
4773
+ require.alias("chaijs-type-detect/lib/type.js", "chaijs-deep-eql/deps/type-detect/index.js");
4774
+ require.alias("chaijs-type-detect/lib/type.js", "chaijs-type-detect/index.js");
4775
+ require.alias("chaijs-deep-eql/lib/eql.js", "chaijs-deep-eql/index.js");
4776
+ require.alias("chai/index.js", "chai/index.js");if (typeof exports == "object") {
4325
4777
  module.exports = require("chai");
4326
4778
  } else if (typeof define == "function" && define.amd) {
4327
- define(function(){ return require("chai"); });
4779
+ define([], function(){ return require("chai"); });
4328
4780
  } else {
4329
4781
  this["chai"] = require("chai");
4330
4782
  }})();