Skip to content

Commit 2ef2c7f

Browse files
committed
internal/util: remove printDeprecationWarning
Removes the internal/util printDeprecationWarning method
1 parent 09d97e9 commit 2ef2c7f

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

lib/internal/util.js

-10
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,6 @@ exports.deprecate = function(fn, msg) {
1919
return exports._deprecate(fn, msg);
2020
};
2121

22-
// All the internal deprecations have to use this function only, as this will
23-
// prepend the prefix to the actual message.
24-
exports.printDeprecationMessage = function(msg, warned, ctor) {
25-
if (warned || process.noDeprecation)
26-
return true;
27-
process.emitWarning(msg, 'DeprecationWarning',
28-
ctor || exports.printDeprecationMessage);
29-
return true;
30-
};
31-
3222
exports.error = function(msg) {
3323
const fmt = `${prefix}${msg}`;
3424
if (arguments.length > 1) {

test/parallel/test-process-no-deprecation.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
// Flags: --expose_internals --no-warnings
2+
// Flags: --no-warnings
33

44
// The --no-warnings flag only supresses writing the warning to stderr, not the
55
// emission of the corresponding event. This test file can be run without it.
@@ -15,8 +15,7 @@ function listener() {
1515

1616
process.addListener('warning', listener);
1717

18-
const internalUtil = require('internal/util');
19-
internalUtil.printDeprecationMessage('Something is deprecated.');
18+
process.emitWarning('Something is deprecated.', 'DeprecationWarning');
2019

2120
// The warning would be emitted in the next tick, so continue after that.
2221
process.nextTick(common.mustCall(() => {
@@ -29,5 +28,5 @@ process.nextTick(common.mustCall(() => {
2928
assert.strictEqual(warning.message, 'Something else is deprecated.');
3029
}));
3130

32-
internalUtil.printDeprecationMessage('Something else is deprecated.');
31+
process.emitWarning('Something else is deprecated.', 'DeprecationWarning');
3332
}));

0 commit comments

Comments
 (0)