Comparing version 5.0.0-rc.0 to 5.0.0
@@ -43,2 +43,4 @@ /*! | ||
* | ||
* - `eql`: This flag contains the deepEqual function to be used by the assertion. | ||
* | ||
* @param {Mixed} obj target of the assertion | ||
@@ -56,2 +58,3 @@ * @param {String} msg (optional) custom error message | ||
util.flag(this, 'message', msg); | ||
util.flag(this, 'eql', config.deepEqual ?? util.eql); | ||
@@ -58,0 +61,0 @@ return util.proxify(this); |
@@ -93,3 +93,29 @@ export const config = { | ||
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 | ||
}; |
@@ -21,3 +21,3 @@ { | ||
], | ||
"version": "5.0.0-rc.0", | ||
"version": "5.0.0", | ||
"repository": { | ||
@@ -24,0 +24,0 @@ "type": "git", |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
506753
12548
0