tests: Disable deprecation warnings when testing deprecated functions

This commit is contained in:
Richard Hansen 2021-11-30 23:17:35 -05:00
parent c4f18a9b3a
commit 6beb5dcaf5
2 changed files with 21 additions and 10 deletions

View file

@ -101,6 +101,7 @@ const padutils = {
* @param {...*} args - Passed to `console.warn`, with a stack trace appended.
*/
warnDeprecated: (...args) => {
if (padutils.warnDeprecated.disabledForTestingOnly) return;
const err = new Error();
if (Error.captureStackTrace) Error.captureStackTrace(err, padutils.warnDeprecated);
err.name = '';