chai 4.3.6 → 4.3.8
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 +1 -7
- package/History.md +1 -1
- package/chai.js +41 -9
- package/lib/chai/utils/objDisplay.js +1 -0
- package/lib/chai/utils/test.js +1 -1
- package/lib/chai.js +1 -1
- package/package.json +2 -2
package/CONTRIBUTING.md
CHANGED
|
@@ -21,7 +21,6 @@ Following these guidelines helps to communicate that you respect the time of the
|
|
|
21
21
|
|
|
22
22
|
- Creating an Issue or Pull Request requires a [GitHub](http://github.com) account.
|
|
23
23
|
- Issue reports should be **clear**, **concise** and **reproducible**. Check to see if your issue has already been resolved in the [master]() branch or already reported in Chai's [GitHub Issue Tracker](https://github.com/chaijs/chai/issues).
|
|
24
|
-
- Pull Requests must adhere to strict [coding style guidelines](https://github.com/chaijs/chai/wiki/Chai-Coding-Style-Guide).
|
|
25
24
|
- In general, avoid submitting PRs for new Assertions without asking core contributors first. More than likely it would be better implemented as a plugin.
|
|
26
25
|
- Additional support is available via the [Google Group](http://groups.google.com/group/chaijs) or on irc.freenode.net#chaijs.
|
|
27
26
|
- **IMPORTANT**: By submitting a patch, you agree to allow the project owner to license your work under the same license as that used by the project.
|
|
@@ -91,7 +90,7 @@ Good pull requests - patches, improvements, new features - are a fantastic help.
|
|
|
91
90
|
|
|
92
91
|
**Please ask first** before embarking on any significant pull request (e.g. implementing features, refactoring code), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project.
|
|
93
92
|
|
|
94
|
-
Please adhere to the coding conventions used throughout a project (indentation, accurate comments, etc.) and any other requirements (such as test coverage).
|
|
93
|
+
Please adhere to the coding conventions used throughout a project (indentation, accurate comments, etc.) and any other requirements (such as test coverage).
|
|
95
94
|
|
|
96
95
|
Follow this process if you'd like your work considered for inclusion in the project:
|
|
97
96
|
|
|
@@ -185,11 +184,6 @@ For most of the documentation you are going to want to visit [ChaiJS.com](http:/
|
|
|
185
184
|
- [API Reference](http://chaijs.com/api/)
|
|
186
185
|
- [Plugins](http://chaijs.com/plugins/)
|
|
187
186
|
|
|
188
|
-
Alternatively, the [wiki](https://github.com/chaijs/chai/wiki) might be what you are looking for.
|
|
189
|
-
|
|
190
|
-
- [Chai Coding Style Guide](https://github.com/chaijs/chai/wiki/Chai-Coding-Style-Guide)
|
|
191
|
-
- [Third-party Resources](https://github.com/chaijs/chai/wiki/Third-Party-Resources)
|
|
192
|
-
|
|
193
187
|
Or finally, you may find a core-contributor or like-minded developer in any of our support channels.
|
|
194
188
|
|
|
195
189
|
- IRC: irc.freenode.org #chaijs
|
package/History.md
CHANGED
package/chai.js
CHANGED
|
@@ -14,7 +14,7 @@ var used = [];
|
|
|
14
14
|
* Chai version
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
exports.version = '4.3.
|
|
17
|
+
exports.version = '4.3.8';
|
|
18
18
|
|
|
19
19
|
/*!
|
|
20
20
|
* Assertion Error
|
|
@@ -8608,6 +8608,7 @@ var config = require('../config');
|
|
|
8608
8608
|
* messages or should be truncated.
|
|
8609
8609
|
*
|
|
8610
8610
|
* @param {Mixed} javascript object to inspect
|
|
8611
|
+
* @returns {string} stringified object
|
|
8611
8612
|
* @name objDisplay
|
|
8612
8613
|
* @namespace Utils
|
|
8613
8614
|
* @api public
|
|
@@ -9062,7 +9063,7 @@ var flag = require('./flag');
|
|
|
9062
9063
|
/**
|
|
9063
9064
|
* ### .test(object, expression)
|
|
9064
9065
|
*
|
|
9065
|
-
* Test
|
|
9066
|
+
* Test an object for expression.
|
|
9066
9067
|
*
|
|
9067
9068
|
* @param {Object} object (constructed Assertion)
|
|
9068
9069
|
* @param {Arguments} chai.Assertion.prototype.assert arguments
|
|
@@ -9430,10 +9431,10 @@ function FakeMap() {
|
|
|
9430
9431
|
}
|
|
9431
9432
|
|
|
9432
9433
|
FakeMap.prototype = {
|
|
9433
|
-
get: function
|
|
9434
|
+
get: function get(key) {
|
|
9434
9435
|
return key[this._key];
|
|
9435
9436
|
},
|
|
9436
|
-
set: function
|
|
9437
|
+
set: function set(key, value) {
|
|
9437
9438
|
if (Object.isExtensible(key)) {
|
|
9438
9439
|
Object.defineProperty(key, this._key, {
|
|
9439
9440
|
value: value,
|
|
@@ -9625,8 +9626,9 @@ function extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandTyp
|
|
|
9625
9626
|
case 'function':
|
|
9626
9627
|
case 'WeakMap':
|
|
9627
9628
|
case 'WeakSet':
|
|
9628
|
-
case 'Error':
|
|
9629
9629
|
return leftHandOperand === rightHandOperand;
|
|
9630
|
+
case 'Error':
|
|
9631
|
+
return keysEqual(leftHandOperand, rightHandOperand, [ 'name', 'message', 'code' ], options);
|
|
9630
9632
|
case 'Arguments':
|
|
9631
9633
|
case 'Int8Array':
|
|
9632
9634
|
case 'Uint8Array':
|
|
@@ -9651,6 +9653,19 @@ function extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandTyp
|
|
|
9651
9653
|
return entriesEqual(leftHandOperand, rightHandOperand, options);
|
|
9652
9654
|
case 'Map':
|
|
9653
9655
|
return entriesEqual(leftHandOperand, rightHandOperand, options);
|
|
9656
|
+
case 'Temporal.PlainDate':
|
|
9657
|
+
case 'Temporal.PlainTime':
|
|
9658
|
+
case 'Temporal.PlainDateTime':
|
|
9659
|
+
case 'Temporal.Instant':
|
|
9660
|
+
case 'Temporal.ZonedDateTime':
|
|
9661
|
+
case 'Temporal.PlainYearMonth':
|
|
9662
|
+
case 'Temporal.PlainMonthDay':
|
|
9663
|
+
return leftHandOperand.equals(rightHandOperand);
|
|
9664
|
+
case 'Temporal.Duration':
|
|
9665
|
+
return leftHandOperand.total('nanoseconds') === rightHandOperand.total('nanoseconds');
|
|
9666
|
+
case 'Temporal.TimeZone':
|
|
9667
|
+
case 'Temporal.Calendar':
|
|
9668
|
+
return leftHandOperand.toString() === rightHandOperand.toString();
|
|
9654
9669
|
default:
|
|
9655
9670
|
return objectEqual(leftHandOperand, rightHandOperand, options);
|
|
9656
9671
|
}
|
|
@@ -9796,6 +9811,11 @@ function getEnumerableKeys(target) {
|
|
|
9796
9811
|
return keys;
|
|
9797
9812
|
}
|
|
9798
9813
|
|
|
9814
|
+
function getNonEnumerableSymbols(target) {
|
|
9815
|
+
var keys = Object.getOwnPropertySymbols(target);
|
|
9816
|
+
return keys;
|
|
9817
|
+
}
|
|
9818
|
+
|
|
9799
9819
|
/*!
|
|
9800
9820
|
* Determines if two objects have matching values, given a set of keys. Defers to deepEqual for the equality check of
|
|
9801
9821
|
* each key. If any value of the given key is not equal, the function will return false (early).
|
|
@@ -9828,14 +9848,16 @@ function keysEqual(leftHandOperand, rightHandOperand, keys, options) {
|
|
|
9828
9848
|
* @param {Object} [options] (Optional)
|
|
9829
9849
|
* @return {Boolean} result
|
|
9830
9850
|
*/
|
|
9831
|
-
|
|
9832
9851
|
function objectEqual(leftHandOperand, rightHandOperand, options) {
|
|
9833
9852
|
var leftHandKeys = getEnumerableKeys(leftHandOperand);
|
|
9834
9853
|
var rightHandKeys = getEnumerableKeys(rightHandOperand);
|
|
9854
|
+
var leftHandSymbols = getNonEnumerableSymbols(leftHandOperand);
|
|
9855
|
+
var rightHandSymbols = getNonEnumerableSymbols(rightHandOperand);
|
|
9856
|
+
leftHandKeys = leftHandKeys.concat(leftHandSymbols);
|
|
9857
|
+
rightHandKeys = rightHandKeys.concat(rightHandSymbols);
|
|
9858
|
+
|
|
9835
9859
|
if (leftHandKeys.length && leftHandKeys.length === rightHandKeys.length) {
|
|
9836
|
-
leftHandKeys.sort()
|
|
9837
|
-
rightHandKeys.sort();
|
|
9838
|
-
if (iterableEqual(leftHandKeys, rightHandKeys) === false) {
|
|
9860
|
+
if (iterableEqual(mapSymbols(leftHandKeys).sort(), mapSymbols(rightHandKeys).sort()) === false) {
|
|
9839
9861
|
return false;
|
|
9840
9862
|
}
|
|
9841
9863
|
return keysEqual(leftHandOperand, rightHandOperand, leftHandKeys, options);
|
|
@@ -9872,6 +9894,16 @@ function isPrimitive(value) {
|
|
|
9872
9894
|
return value === null || typeof value !== 'object';
|
|
9873
9895
|
}
|
|
9874
9896
|
|
|
9897
|
+
function mapSymbols(arr) {
|
|
9898
|
+
return arr.map(function mapSymbol(entry) {
|
|
9899
|
+
if (typeof entry === 'symbol') {
|
|
9900
|
+
return entry.toString();
|
|
9901
|
+
}
|
|
9902
|
+
|
|
9903
|
+
return entry;
|
|
9904
|
+
});
|
|
9905
|
+
}
|
|
9906
|
+
|
|
9875
9907
|
},{"type-detect":39}],36:[function(require,module,exports){
|
|
9876
9908
|
'use strict';
|
|
9877
9909
|
|
package/lib/chai/utils/test.js
CHANGED
|
@@ -13,7 +13,7 @@ var flag = require('./flag');
|
|
|
13
13
|
/**
|
|
14
14
|
* ### .test(object, expression)
|
|
15
15
|
*
|
|
16
|
-
* Test
|
|
16
|
+
* Test an object for expression.
|
|
17
17
|
*
|
|
18
18
|
* @param {Object} object (constructed Assertion)
|
|
19
19
|
* @param {Arguments} chai.Assertion.prototype.assert arguments
|
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": "4.3.
|
|
20
|
+
"version": "4.3.8",
|
|
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": "^
|
|
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",
|