Skip to content

Commit

Permalink
util: Remove p, has been deprecated for years
Browse files Browse the repository at this point in the history
Update deprecation test to use another method.

Ref: #2529
PR-URL: #3432
Reviewed-By: Brian White <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
  • Loading branch information
geek authored and targos committed Oct 19, 2015
1 parent f875c73 commit 8b4adb2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
7 changes: 0 additions & 7 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -790,13 +790,6 @@ function hasOwnProperty(obj, prop) {

// Deprecated old stuff.

exports.p = internalUtil.deprecate(function() {
for (var i = 0, len = arguments.length; i < len; ++i) {
console.error(exports.inspect(arguments[i]));
}
}, 'util.p is deprecated. Use console.error instead.');


exports.exec = internalUtil.deprecate(function() {
return require('child_process').exec.apply(this, arguments);
}, 'util.exec is deprecated. Use child_process.exec instead.');
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/deprecated.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
require('util').p('This is deprecated');
require('util').debug('This is deprecated');
10 changes: 5 additions & 5 deletions test/sequential/test-deprecation-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ execFile(node, normal, function(er, stdout, stderr) {
console.error('normal: show deprecation warning');
assert.equal(er, null);
assert.equal(stdout, '');
assert.equal(stderr, '(node) util.p is deprecated. Use console.error ' +
'instead.\n\'This is deprecated\'\n');
assert.equal(stderr, '(node) util.debug is deprecated. Use console.error ' +
'instead.\nDEBUG: This is deprecated\n');
console.log('normal ok');
});

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

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

Expand Down

0 comments on commit 8b4adb2

Please sign in to comment.