Skip to content

Commit

Permalink
lib: move DEP0028 to end of life
Browse files Browse the repository at this point in the history
PR-URL: #25377
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
cjihrig committed Jan 10, 2019
1 parent 10df21b commit a665d13
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 33 deletions.
9 changes: 5 additions & 4 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,9 @@ Type: End-of-Life
### DEP0028: util.debug()
<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/xxxxx
description: End-of-Life.
- version:
- v4.8.6
- v6.12.0
Expand All @@ -621,10 +624,9 @@ changes:
description: Runtime deprecation.
-->

Type: Runtime
Type: End-of-Life

The [`util.debug()`][] API is deprecated. Please use [`console.error()`][]
instead.
`util.debug()` has been removed. Please use [`console.error()`][] instead.

<a id="DEP0029"></a>
### DEP0029: util.error()
Expand Down Expand Up @@ -2395,7 +2397,6 @@ Setting the TLS ServerName to an IP address is not permitted by
[`url.parse()`]: url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost
[`url.resolve()`]: url.html#url_url_resolve_from_to
[`util._extend()`]: util.html#util_util_extend_target_source
[`util.debug()`]: util.html#util_util_debug_string
[`util.error()`]: util.html#util_util_error_strings
[`util.getSystemErrorName()`]: util.html#util_util_getsystemerrorname_err
[`util.inspect()`]: util.html#util_util_inspect_object_options
Expand Down
12 changes: 0 additions & 12 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -1714,18 +1714,6 @@ Node.js modules. The community found and used it anyway.
It is deprecated and should not be used in new code. JavaScript comes with very
similar built-in functionality through [`Object.assign()`].

### util.debug(string)
<!-- YAML
added: v0.3.0
deprecated: v0.11.3
-->

> Stability: 0 - Deprecated: Use [`console.error()`][] instead.
* `string` {string} The message to print to `stderr`

Deprecated predecessor of `console.error`.

### util.error([...strings])
<!-- YAML
added: v0.3.0
Expand Down
8 changes: 0 additions & 8 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,6 @@ function _extend(target, source) {
}

// Deprecated old stuff.

function debug(x) {
process.stderr.write(`DEBUG: ${x}\n`);
}

function error(...args) {
for (var i = 0, len = args.length; i < len; ++i) {
process.stderr.write(`${args[i]}\n`);
Expand Down Expand Up @@ -429,9 +424,6 @@ module.exports = exports = {
types,

// Deprecated Old Stuff
debug: deprecate(debug,
'util.debug is deprecated. Use console.error instead.',
'DEP0028'),
error: deprecate(error,
'util.error is deprecated. Use console.error instead.',
'DEP0029')
Expand Down
8 changes: 7 additions & 1 deletion test/fixtures/deprecated.js
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
require('util').debug('This is deprecated');
'use strict';
const util = require('util');
const deprecated = util.deprecate(() => {
console.error('This is deprecated');
}, 'this function is deprecated');

deprecated();
2 changes: 0 additions & 2 deletions test/parallel/test-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,9 @@ assert.strictEqual(util.isFunction(), false);
assert.strictEqual(util.isFunction('string'), false);

common.expectWarning('DeprecationWarning', [
['util.debug is deprecated. Use console.error instead.', 'DEP0028'],
['util.error is deprecated. Use console.error instead.', 'DEP0029']
]);

util.debug('test');
util.error('test');

{
Expand Down
10 changes: 4 additions & 6 deletions test/sequential/test-deprecation-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ execFile(node, normal, function(er, stdout, stderr) {
console.error('normal: show deprecation warning');
assert.strictEqual(er, null);
assert.strictEqual(stdout, '');
assert(/util\.debug is deprecated/.test(stderr));
assert(/this function is deprecated/.test(stderr));
console.log('normal ok');
});

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

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

Expand Down

0 comments on commit a665d13

Please sign in to comment.