Improved readability of matcher-related deprecations
* Include stack traces. This makes it easier to find the matcher that needs to be updated, particularly when it comes from a library rather than the user's own code. * Show each deprecation only once unless `config.verboseDeprecations` is set. Since matchers are often added in a global `beforeEach`, logging deprecations every time can be overwhelming.
This commit is contained in:
committed by
Steve Gravrock
parent
90d6f9d73c
commit
9aed55bb91
@@ -34,9 +34,9 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
*/
|
||||
MatchersUtil.prototype.contains = function(haystack, needle, customTesters) {
|
||||
if (customTesters) {
|
||||
j$.getEnv().deprecated('Passing custom equality testers to ' +
|
||||
'MatchersUtil#contains is deprecated. See ' +
|
||||
'<https://jasmine.github.io/tutorials/upgrading_to_4.0> for details.');
|
||||
j$.getEnv().deprecatedOnceWithStack('Passing custom equality testers ' +
|
||||
'to MatchersUtil#contains is deprecated. ' +
|
||||
'See <https://jasmine.github.io/tutorials/upgrading_to_4.0> for details.');
|
||||
}
|
||||
|
||||
if (j$.isSet(haystack)) {
|
||||
@@ -138,14 +138,14 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
diffBuilder = customTestersOrDiffBuilder;
|
||||
} else {
|
||||
if (customTestersOrDiffBuilder) {
|
||||
j$.getEnv().deprecated('Passing custom equality testers to ' +
|
||||
'MatchersUtil#equals is deprecated. See ' +
|
||||
'<https://jasmine.github.io/tutorials/upgrading_to_4.0> for details.');
|
||||
j$.getEnv().deprecatedOnceWithStack('Passing custom equality testers ' +
|
||||
'to MatchersUtil#equals is deprecated. ' +
|
||||
'See <https://jasmine.github.io/tutorials/upgrading_to_4.0> for details.');
|
||||
}
|
||||
|
||||
if (diffBuilderOrNothing) {
|
||||
j$.getEnv().deprecated('Diff builder should be passed as the third argument ' +
|
||||
'to MatchersUtil#equals, not the fourth. ' +
|
||||
j$.getEnv().deprecatedOnceWithStack('Diff builder should be passed ' +
|
||||
'as the third argument to MatchersUtil#equals, not the fourth. ' +
|
||||
'See <https://jasmine.github.io/tutorials/upgrading_to_4.0> for details.');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user