Comparing version 4.3.10 to 4.4.1
@@ -55,2 +55,4 @@ /*! | ||
* | ||
* - `eql`: This flag contains the deepEqual function to be used by the assertion. | ||
* | ||
* @param {Mixed} obj target of the assertion | ||
@@ -68,2 +70,3 @@ * @param {String} msg (optional) custom error message | ||
flag(this, 'message', msg); | ||
flag(this, 'eql', config.deepEqual || util.eql); | ||
@@ -70,0 +73,0 @@ return util.proxify(this); |
@@ -93,3 +93,29 @@ module.exports = { | ||
proxyExcludedKeys: ['then', 'catch', 'inspect', 'toJSON'] | ||
proxyExcludedKeys: ['then', 'catch', 'inspect', 'toJSON'], | ||
/** | ||
* ### config.deepEqual | ||
* | ||
* User configurable property, defines which a custom function to use for deepEqual | ||
* comparisons. | ||
* By default, the function used is the one from the `deep-eql` package without custom comparator. | ||
* | ||
* // use a custom comparator | ||
* chai.config.deepEqual = (expected, actual) => { | ||
* return chai.util.eql(expected, actual, { | ||
* comparator: (expected, actual) => { | ||
* // for non number comparison, use the default behavior | ||
* if(typeof expected !== 'number') return null; | ||
* // allow a difference of 10 between compared numbers | ||
* return typeof actual === 'number' && Math.abs(actual - expected) < 10 | ||
* } | ||
* }) | ||
* }; | ||
* | ||
* @param {Function} | ||
* @api public | ||
*/ | ||
deepEqual: null | ||
}; |
@@ -20,3 +20,3 @@ { | ||
], | ||
"version": "4.3.10", | ||
"version": "4.4.1", | ||
"repository": { | ||
@@ -23,0 +23,0 @@ "type": "git", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
754388
18862