Skip to content

Commit a665d13

Browse files
committed
lib: move DEP0028 to end of life
PR-URL: #25377 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 10df21b commit a665d13

File tree

6 files changed

+16
-33
lines changed

6 files changed

+16
-33
lines changed

doc/api/deprecations.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,9 @@ Type: End-of-Life
611611
### DEP0028: util.debug()
612612
<!-- YAML
613613
changes:
614+
- version: REPLACEME
615+
pr-url: https://github.com/nodejs/node/pull/xxxxx
616+
description: End-of-Life.
614617
- version:
615618
- v4.8.6
616619
- v6.12.0
@@ -621,10 +624,9 @@ changes:
621624
description: Runtime deprecation.
622625
-->
623626

624-
Type: Runtime
627+
Type: End-of-Life
625628

626-
The [`util.debug()`][] API is deprecated. Please use [`console.error()`][]
627-
instead.
629+
`util.debug()` has been removed. Please use [`console.error()`][] instead.
628630

629631
<a id="DEP0029"></a>
630632
### DEP0029: util.error()
@@ -2395,7 +2397,6 @@ Setting the TLS ServerName to an IP address is not permitted by
23952397
[`url.parse()`]: url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost
23962398
[`url.resolve()`]: url.html#url_url_resolve_from_to
23972399
[`util._extend()`]: util.html#util_util_extend_target_source
2398-
[`util.debug()`]: util.html#util_util_debug_string
23992400
[`util.error()`]: util.html#util_util_error_strings
24002401
[`util.getSystemErrorName()`]: util.html#util_util_getsystemerrorname_err
24012402
[`util.inspect()`]: util.html#util_util_inspect_object_options

doc/api/util.md

-12
Original file line numberDiff line numberDiff line change
@@ -1714,18 +1714,6 @@ Node.js modules. The community found and used it anyway.
17141714
It is deprecated and should not be used in new code. JavaScript comes with very
17151715
similar built-in functionality through [`Object.assign()`].
17161716

1717-
### util.debug(string)
1718-
<!-- YAML
1719-
added: v0.3.0
1720-
deprecated: v0.11.3
1721-
-->
1722-
1723-
> Stability: 0 - Deprecated: Use [`console.error()`][] instead.
1724-
1725-
* `string` {string} The message to print to `stderr`
1726-
1727-
Deprecated predecessor of `console.error`.
1728-
17291717
### util.error([...strings])
17301718
<!-- YAML
17311719
added: v0.3.0

lib/util.js

-8
Original file line numberDiff line numberDiff line change
@@ -325,11 +325,6 @@ function _extend(target, source) {
325325
}
326326

327327
// Deprecated old stuff.
328-
329-
function debug(x) {
330-
process.stderr.write(`DEBUG: ${x}\n`);
331-
}
332-
333328
function error(...args) {
334329
for (var i = 0, len = args.length; i < len; ++i) {
335330
process.stderr.write(`${args[i]}\n`);
@@ -429,9 +424,6 @@ module.exports = exports = {
429424
types,
430425

431426
// Deprecated Old Stuff
432-
debug: deprecate(debug,
433-
'util.debug is deprecated. Use console.error instead.',
434-
'DEP0028'),
435427
error: deprecate(error,
436428
'util.error is deprecated. Use console.error instead.',
437429
'DEP0029')

test/fixtures/deprecated.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
require('util').debug('This is deprecated');
1+
'use strict';
2+
const util = require('util');
3+
const deprecated = util.deprecate(() => {
4+
console.error('This is deprecated');
5+
}, 'this function is deprecated');
6+
7+
deprecated();

test/parallel/test-util.js

-2
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,9 @@ assert.strictEqual(util.isFunction(), false);
145145
assert.strictEqual(util.isFunction('string'), false);
146146

147147
common.expectWarning('DeprecationWarning', [
148-
['util.debug is deprecated. Use console.error instead.', 'DEP0028'],
149148
['util.error is deprecated. Use console.error instead.', 'DEP0029']
150149
]);
151150

152-
util.debug('test');
153151
util.error('test');
154152

155153
{

test/sequential/test-deprecation-flags.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ execFile(node, normal, function(er, stdout, stderr) {
4444
console.error('normal: show deprecation warning');
4545
assert.strictEqual(er, null);
4646
assert.strictEqual(stdout, '');
47-
assert(/util\.debug is deprecated/.test(stderr));
47+
assert(/this function is deprecated/.test(stderr));
4848
console.log('normal ok');
4949
});
5050

5151
execFile(node, noDep, function(er, stdout, stderr) {
5252
console.error('--no-deprecation: silence deprecations');
5353
assert.strictEqual(er, null);
5454
assert.strictEqual(stdout, '');
55-
assert.strictEqual(stderr, 'DEBUG: This is deprecated\n');
55+
assert.strictEqual(stderr.trim(), 'This is deprecated');
5656
console.log('silent ok');
5757
});
5858

@@ -62,10 +62,8 @@ execFile(node, traceDep, function(er, stdout, stderr) {
6262
assert.strictEqual(stdout, '');
6363
const stack = stderr.trim().split('\n');
6464
// just check the top and bottom.
65-
assert(
66-
/util\.debug is deprecated\. Use console\.error instead\./.test(stack[1])
67-
);
68-
assert(/DEBUG: This is deprecated/.test(stack[0]));
65+
assert(/this function is deprecated/.test(stack[1]));
66+
assert(/This is deprecated/.test(stack[0]));
6967
console.log('trace ok');
7068
});
7169

0 commit comments

Comments
 (0)