Added deprecation messages to interfaces that will be removed in 4.0

* `jasmine.pp`
* `jasmine.matchersUtil`
* Matchers that expect to receive custom equality testers
* Passing custom equality testers to `matchersUtil.contains`
* Passing custom equality testers to `matchersUtil.equals`
This commit is contained in:
Steve Gravrock
2019-11-28 10:50:55 -08:00
committed by Steve Gravrock
parent 258d55469e
commit 90d6f9d73c
16 changed files with 321 additions and 49 deletions

View File

@@ -56,10 +56,10 @@ getJasmineRequireObj().asymmetricEqualityTesterArgCompatShim = function(j$) {
i,
k;
copy(self, customEqualityTesters, 'length');
copyAndDeprecate(self, customEqualityTesters, 'length');
for (i = 0; i < customEqualityTesters.length; i++) {
copy(self, customEqualityTesters, i);
copyAndDeprecate(self, customEqualityTesters, i);
}
var props = arrayProps();
@@ -67,16 +67,22 @@ getJasmineRequireObj().asymmetricEqualityTesterArgCompatShim = function(j$) {
for (i = 0; i < props.length; i++) {
k = props[i];
if (k !== 'length') {
copy(self, Array.prototype, k);
copyAndDeprecate(self, Array.prototype, k);
}
}
return self;
}
function copy(dest, src, propName) {
function copyAndDeprecate(dest, src, propName) {
Object.defineProperty(dest, propName, {
get: function() {
j$.getEnv().deprecated(
'The second argument to asymmetricMatch is now a ' +
'MatchersUtil. Using it as an array of custom equality testers is ' +
'deprecated and will stop working in a future release. ' +
'See <https://jasmine.github.io/tutorials/upgrading_to_4.0> for details.'
);
return src[propName];
}
});