lib: move DEP0028 to end of life

PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
cjihrig 2019-01-07 13:19:49 -05:00
parent 10df21b071
commit a665d13ad9
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5
6 changed files with 16 additions and 33 deletions

View File

@ -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
@ -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()
@ -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

View File

@ -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

View File

@ -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`);
@ -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')

View File

@ -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();

View File

@ -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');
{

View File

@ -44,7 +44,7 @@ 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');
});
@ -52,7 +52,7 @@ 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');
});
@ -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');
});