diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 113986918f046e..1c660fef0f369a 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2110,9 +2110,12 @@ changes: - version: v10.9.0 pr-url: https://github.com/nodejs/node/pull/22004 description: Documentation-only deprecation. + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/26500 + description: Added support for `--pending-deprecation`. --> -Type: Documentation-only +Type: Documentation-only (supports [`--pending-deprecation`][]) `process.binding()` is for use by Node.js internal code only. diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js index d295a5fec7e286..3e64540aa32ae2 100644 --- a/lib/internal/bootstrap/pre_execution.js +++ b/lib/internal/bootstrap/pre_execution.js @@ -149,6 +149,12 @@ function initializeDeprecations() { value: noBrowserGlobals }); } + + if (pendingDeprecation) { + process.binding = deprecate(process.binding, + 'process.binding() is deprecated. ' + + 'Please use public APIs instead.', 'DEP0111'); + } } function setupChildProcessIpcChannel() { diff --git a/test/parallel/test-err-name-deprecation.js b/test/parallel/test-err-name-deprecation.js index d9af7e3804ec4a..58dff38364c818 100644 --- a/test/parallel/test-err-name-deprecation.js +++ b/test/parallel/test-err-name-deprecation.js @@ -3,11 +3,14 @@ const common = require('../common'); // Flags: --pending-deprecation -common.expectWarning( - 'DeprecationWarning', - 'Directly calling process.binding(\'uv\').errname() is being ' + - 'deprecated. Please make sure to use util.getSystemErrorName() instead.', - 'DEP0119' -); +common.expectWarning({ + DeprecationWarning: [ + ['process.binding() is deprecated. Please use public APIs instead.', + 'DEP0111'], + ['Directly calling process.binding(\'uv\').errname() is being ' + + 'deprecated. Please make sure to use util.getSystemErrorName() instead.', + 'DEP0119'] + ] +}); process.binding('uv').errname(-1);