chai 4.3.6 → 4.3.7

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.
Files changed (2) hide show
  1. package/chai.js +38 -7
  2. package/package.json +2 -2
package/chai.js CHANGED
@@ -9430,10 +9430,10 @@ function FakeMap() {
9430
9430
  }
9431
9431
 
9432
9432
  FakeMap.prototype = {
9433
- get: function getMap(key) {
9433
+ get: function get(key) {
9434
9434
  return key[this._key];
9435
9435
  },
9436
- set: function setMap(key, value) {
9436
+ set: function set(key, value) {
9437
9437
  if (Object.isExtensible(key)) {
9438
9438
  Object.defineProperty(key, this._key, {
9439
9439
  value: value,
@@ -9625,8 +9625,9 @@ function extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandTyp
9625
9625
  case 'function':
9626
9626
  case 'WeakMap':
9627
9627
  case 'WeakSet':
9628
- case 'Error':
9629
9628
  return leftHandOperand === rightHandOperand;
9629
+ case 'Error':
9630
+ return keysEqual(leftHandOperand, rightHandOperand, [ 'name', 'message', 'code' ], options);
9630
9631
  case 'Arguments':
9631
9632
  case 'Int8Array':
9632
9633
  case 'Uint8Array':
@@ -9651,6 +9652,19 @@ function extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandTyp
9651
9652
  return entriesEqual(leftHandOperand, rightHandOperand, options);
9652
9653
  case 'Map':
9653
9654
  return entriesEqual(leftHandOperand, rightHandOperand, options);
9655
+ case 'Temporal.PlainDate':
9656
+ case 'Temporal.PlainTime':
9657
+ case 'Temporal.PlainDateTime':
9658
+ case 'Temporal.Instant':
9659
+ case 'Temporal.ZonedDateTime':
9660
+ case 'Temporal.PlainYearMonth':
9661
+ case 'Temporal.PlainMonthDay':
9662
+ return leftHandOperand.equals(rightHandOperand);
9663
+ case 'Temporal.Duration':
9664
+ return leftHandOperand.total('nanoseconds') === rightHandOperand.total('nanoseconds');
9665
+ case 'Temporal.TimeZone':
9666
+ case 'Temporal.Calendar':
9667
+ return leftHandOperand.toString() === rightHandOperand.toString();
9654
9668
  default:
9655
9669
  return objectEqual(leftHandOperand, rightHandOperand, options);
9656
9670
  }
@@ -9796,6 +9810,11 @@ function getEnumerableKeys(target) {
9796
9810
  return keys;
9797
9811
  }
9798
9812
 
9813
+ function getNonEnumerableSymbols(target) {
9814
+ var keys = Object.getOwnPropertySymbols(target);
9815
+ return keys;
9816
+ }
9817
+
9799
9818
  /*!
9800
9819
  * Determines if two objects have matching values, given a set of keys. Defers to deepEqual for the equality check of
9801
9820
  * each key. If any value of the given key is not equal, the function will return false (early).
@@ -9828,14 +9847,16 @@ function keysEqual(leftHandOperand, rightHandOperand, keys, options) {
9828
9847
  * @param {Object} [options] (Optional)
9829
9848
  * @return {Boolean} result
9830
9849
  */
9831
-
9832
9850
  function objectEqual(leftHandOperand, rightHandOperand, options) {
9833
9851
  var leftHandKeys = getEnumerableKeys(leftHandOperand);
9834
9852
  var rightHandKeys = getEnumerableKeys(rightHandOperand);
9853
+ var leftHandSymbols = getNonEnumerableSymbols(leftHandOperand);
9854
+ var rightHandSymbols = getNonEnumerableSymbols(rightHandOperand);
9855
+ leftHandKeys = leftHandKeys.concat(leftHandSymbols);
9856
+ rightHandKeys = rightHandKeys.concat(rightHandSymbols);
9857
+
9835
9858
  if (leftHandKeys.length && leftHandKeys.length === rightHandKeys.length) {
9836
- leftHandKeys.sort();
9837
- rightHandKeys.sort();
9838
- if (iterableEqual(leftHandKeys, rightHandKeys) === false) {
9859
+ if (iterableEqual(mapSymbols(leftHandKeys).sort(), mapSymbols(rightHandKeys).sort()) === false) {
9839
9860
  return false;
9840
9861
  }
9841
9862
  return keysEqual(leftHandOperand, rightHandOperand, leftHandKeys, options);
@@ -9872,6 +9893,16 @@ function isPrimitive(value) {
9872
9893
  return value === null || typeof value !== 'object';
9873
9894
  }
9874
9895
 
9896
+ function mapSymbols(arr) {
9897
+ return arr.map(function mapSymbol(entry) {
9898
+ if (typeof entry === 'symbol') {
9899
+ return entry.toString();
9900
+ }
9901
+
9902
+ return entry;
9903
+ });
9904
+ }
9905
+
9875
9906
  },{"type-detect":39}],36:[function(require,module,exports){
9876
9907
  'use strict';
9877
9908
 
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": "4.3.6",
20
+ "version": "4.3.7",
21
21
  "repository": {
22
22
  "type": "git",
23
23
  "url": "https://github.com/chaijs/chai"
@@ -42,7 +42,7 @@
42
42
  "dependencies": {
43
43
  "assertion-error": "^1.1.0",
44
44
  "check-error": "^1.0.2",
45
- "deep-eql": "^3.0.1",
45
+ "deep-eql": "^4.1.2",
46
46
  "get-func-name": "^2.0.0",
47
47
  "loupe": "^2.3.1",
48
48
  "pathval": "^1.1.1",