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:
committed by
Steve Gravrock
parent
258d55469e
commit
90d6f9d73c
@@ -147,4 +147,27 @@ describe('Custom Async Matchers (Integration)', function() {
|
||||
env.addReporter({ specDone: specExpectations, jasmineDone: done });
|
||||
env.execute();
|
||||
});
|
||||
|
||||
it('logs a deprecation warning if the matcher factory takes two arguments', function (done) {
|
||||
var matcherFactory = function (matchersUtil, customEqualityTesters) {
|
||||
return { compare: function () {} };
|
||||
};
|
||||
|
||||
spyOn(env, 'deprecated');
|
||||
|
||||
env.it('a spec', function() {
|
||||
env.addAsyncMatchers({toBeFoo: matcherFactory});
|
||||
});
|
||||
|
||||
function jasmineDone() {
|
||||
expect(env.deprecated).toHaveBeenCalledWith('The matcher factory for "toBeFoo" ' +
|
||||
'accepts custom equality testers, but this parameter will no longer be passed ' +
|
||||
'in a future release. ' +
|
||||
'See <https://jasmine.github.io/tutorials/upgrading_to_4.0> for details.');
|
||||
done();
|
||||
}
|
||||
|
||||
env.addReporter({jasmineDone: jasmineDone});
|
||||
env.execute();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -88,6 +88,7 @@ describe("Custom Matchers (Integration)", function () {
|
||||
it("supports asymmetric equality testers that take a list of custom equality testers", function(done) {
|
||||
// TODO: remove this in the next major release.
|
||||
spyOn(jasmineUnderTest, 'getEnv').and.returnValue(env);
|
||||
spyOn(env, 'deprecated'); // suppress warnings
|
||||
|
||||
env.it("spec using custom asymmetric equality tester", function() {
|
||||
var customEqualityFn = function(a, b) {
|
||||
@@ -265,4 +266,27 @@ describe("Custom Matchers (Integration)", function () {
|
||||
env.addReporter({specDone: specExpectations, jasmineDone: done});
|
||||
env.execute();
|
||||
});
|
||||
|
||||
it('logs a deprecation warning if the matcher factory takes two arguments', function(done) {
|
||||
var matcherFactory = function (matchersUtil, customEqualityTesters) {
|
||||
return { compare: function() {} };
|
||||
};
|
||||
|
||||
spyOn(env, 'deprecated');
|
||||
|
||||
env.it('a spec', function() {
|
||||
env.addMatchers({toBeFoo: matcherFactory});
|
||||
});
|
||||
|
||||
function jasmineDone() {
|
||||
expect(env.deprecated).toHaveBeenCalledWith('The matcher factory for "toBeFoo" ' +
|
||||
'accepts custom equality testers, but this parameter will no longer be passed ' +
|
||||
'in a future release. ' +
|
||||
'See <https://jasmine.github.io/tutorials/upgrading_to_4.0> for details.');
|
||||
done();
|
||||
}
|
||||
|
||||
env.addReporter({jasmineDone: jasmineDone});
|
||||
env.execute();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user