diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-05-09 18:09:06 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-05-09 18:10:24 +0200 |
commit | 3cda6237efaaf2f6b4c3775c9d1eed36047ec11d (patch) | |
tree | 93175feda16759979bc14d861fcbbcf254ebbecb /core/src | |
parent | 3007c7a19c44e27f8944705e64abecb372ccca73 (diff) | |
download | nextcloud-server-3cda6237efaaf2f6b4c3775c9d1eed36047ec11d.tar.gz nextcloud-server-3cda6237efaaf2f6b4c3775c9d1eed36047ec11d.zip |
Do not show deprecation warnings during test runs
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/globals.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/core/src/globals.js b/core/src/globals.js index 8476ccaf18e..312952fe90c 100644 --- a/core/src/globals.js +++ b/core/src/globals.js @@ -21,6 +21,12 @@ import appswebroots from "./OC/appswebroots"; +const warnIfNotTesting = function() { + if (window.TESTING === undefined) { + console.warn.apply(console, arguments) + } +} + /** * * @param {Function} func the library to deprecate @@ -29,7 +35,7 @@ import appswebroots from "./OC/appswebroots"; const deprecate = (func, funcName) => { const oldFunc = func const newFunc = function() { - console.warn(`The ${funcName} library is deprecated! It will be removed in nextcloud 19.`) + warnIfNotTesting(`The ${funcName} library is deprecated! It will be removed in nextcloud 19.`) return oldFunc.apply(this, arguments) } Object.assign(newFunc, oldFunc) @@ -43,9 +49,9 @@ const setDeprecatedProp = (global, val, msg) => { Object.defineProperty(window, global, { get: () => { if (msg) { - console.warn(`${global} is deprecated: ${msg}`) + warnIfNotTesting(`${global} is deprecated: ${msg}`) } else { - console.warn(`${global} is deprecated`) + warnIfNotTesting(`${global} is deprecated`) } return val } |