You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provide a way for fine-grained control of deprecation warnings, allowing each deprecation to be "silenced" one-by-one
Make config.showDeprecationWarnings to accept not only boolean, but also a fine-grained config, for example:
new config silenceDeprecationWarnings with reverse behavior. The benefit of silenceDeprecationWarnings is that if new deprecation will be added - it will compain about it while showDeprecationWarnings will silently swallow it
allowing to pass custom warnDeprecated function, so warnings could be handled in other way
Problem
When you have huge codebase it is a real pain to deal with all deprecations immediately. On the other side showDeprecationWarnings silences all warnings and will not complain if people are using deprecated function, which was already "cleaned" from the codebase
Expected behavior
VTU should show deprecation warnings for elements, specified in showDeprecationWarnings but keep silence for other deprecations
Alternatives
Right now I have such ugly code in setting my tests in Jest:
constoriginalConsoleError=global.console.error;constALLOWED_DEPRECATION_MESSAGES=[
...[// subject for automated codemod'`find`','`findAll`',// requires custom matcher'isVisible','setMethods',// 'is',].map(method=>`${method} is deprecated and will be removed in the next major version.`),'options.attachToDocument is deprecated in favor of options.attachTo',// +'overwriting methods via the `methods` property is deprecated','name is deprecated and will be removed in the next major version',// easy];global.console.error=functionconsoleErrorWithSuppression(message, ...args){if(message.startsWith('[vue-test-utils]')&&ALLOWED_DEPRECATION_MESSAGES.find(warning=>message.includes(warning))){console.warn(message, ...args);}originalConsoleError.call(console,message, ...args);};
I'm quite uncomfortable with this hack and will be happy to submit PR as soon as the desired direction will be selected
The text was updated successfully, but these errors were encountered:
I don't think the hack is that bad - essentially this request is just to move that logic into VTU. I don't see a significant downside to adding this to VTU - it's purely additive. I wonder if many other people are having the problem (GL has likely one of the largest Vue code-bases on the planet, haha).
I don't have a strong opinion, either way. How about we get a fix for #1532 merged up then tackle this? I think #1532 has higher immediate value, and probably reduce your deprecation warnings a lot as well.
Feature Description
Provide a way for fine-grained control of deprecation warnings, allowing each deprecation to be "silenced" one-by-one
Make config.showDeprecationWarnings to accept not only boolean, but also a fine-grained config, for example:
Alternate approaches:
silenceDeprecationWarnings
with reverse behavior. The benefit ofsilenceDeprecationWarnings
is that if new deprecation will be added - it will compain about it whileshowDeprecationWarnings
will silently swallow itwarnDeprecated
function, so warnings could be handled in other wayProblem
When you have huge codebase it is a real pain to deal with all deprecations immediately. On the other side
showDeprecationWarnings
silences all warnings and will not complain if people are using deprecated function, which was already "cleaned" from the codebaseExpected behavior
VTU should show deprecation warnings for elements, specified in
showDeprecationWarnings
but keep silence for other deprecationsAlternatives
Right now I have such ugly code in setting my tests in Jest:
I'm quite uncomfortable with this hack and will be happy to submit PR as soon as the desired direction will be selected
The text was updated successfully, but these errors were encountered: