diff --git a/packages/meteor/deprecate.js b/packages/meteor/deprecate.js index 1e213ceeab..d00ab68bf0 100644 --- a/packages/meteor/deprecate.js +++ b/packages/meteor/deprecate.js @@ -1,3 +1,13 @@ +if (Meteor.isServer && Meteor.isDevelopment) { + if (typeof __meteor_runtime_config__ === 'object') { + var noDeprecations = process.env.METEOR_NO_DEPRECATIONS; + if (noDeprecations === 'true' || noDeprecations === 'false') { + noDeprecations = noDeprecations === 'true'; + } + __meteor_runtime_config__.noDeprecations = noDeprecations; + } +} + function cleanStackTrace(stackTrace) { if (!stackTrace || typeof stackTrace !== 'string') return []; var lines = stackTrace.split('\n'); @@ -28,6 +38,14 @@ Meteor.deprecate = function () { var stackStrace = cleanStackTrace(new Error().stack || ''); var messages = Array.prototype.slice.call(arguments); // Convert arguments to array + if (typeof __meteor_runtime_config__.noDeprecations === 'string') { + const noDeprecationPattern = new RegExp(__meteor_runtime_config__.noDeprecations); + if (noDeprecationPattern.test(stackStrace)) { + return; + } + } else if (typeof __meteor_runtime_config__.noDeprecations === 'boolean' && __meteor_runtime_config__.noDeprecations) { + return; + } if (stackStrace.length > 0) { messages.push('\n\n', 'Trace:', '\n', stackStrace); }