From 7b73f559029a10474b74a83bfb1117ab512785d4 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Thu, 18 Aug 2016 14:01:44 -0700 Subject: [PATCH] internal/util: remove printDeprecationWarning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes the internal/util printDeprecationWarning method PR-URL: https://github.com/nodejs/node/pull/8166 Reviewed-By: Сковорода Никита Андреевич Reviewed-By: Myles Borins --- lib/internal/util.js | 10 ---------- test/parallel/test-process-no-deprecation.js | 7 +++---- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/lib/internal/util.js b/lib/internal/util.js index dae45b0ebbd9a4..fd1f3b487c74d7 100644 --- a/lib/internal/util.js +++ b/lib/internal/util.js @@ -19,16 +19,6 @@ exports.deprecate = function(fn, msg) { return exports._deprecate(fn, msg); }; -// All the internal deprecations have to use this function only, as this will -// prepend the prefix to the actual message. -exports.printDeprecationMessage = function(msg, warned, ctor) { - if (warned || process.noDeprecation) - return true; - process.emitWarning(msg, 'DeprecationWarning', - ctor || exports.printDeprecationMessage); - return true; -}; - exports.error = function(msg) { const fmt = `${prefix}${msg}`; if (arguments.length > 1) { diff --git a/test/parallel/test-process-no-deprecation.js b/test/parallel/test-process-no-deprecation.js index 9185f8beb58bd6..60394ea0d38ddf 100644 --- a/test/parallel/test-process-no-deprecation.js +++ b/test/parallel/test-process-no-deprecation.js @@ -1,5 +1,5 @@ 'use strict'; -// Flags: --expose_internals --no-warnings +// Flags: --no-warnings // The --no-warnings flag only supresses writing the warning to stderr, not the // emission of the corresponding event. This test file can be run without it. @@ -15,8 +15,7 @@ function listener() { process.addListener('warning', listener); -const internalUtil = require('internal/util'); -internalUtil.printDeprecationMessage('Something is deprecated.'); +process.emitWarning('Something is deprecated.', 'DeprecationWarning'); // The warning would be emitted in the next tick, so continue after that. process.nextTick(common.mustCall(() => { @@ -29,5 +28,5 @@ process.nextTick(common.mustCall(() => { assert.strictEqual(warning.message, 'Something else is deprecated.'); })); - internalUtil.printDeprecationMessage('Something else is deprecated.'); + process.emitWarning('Something else is deprecated.', 'DeprecationWarning'); }));