diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 24d4a3ea32058e..59f19e5b549b32 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2134,9 +2134,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 1ba6c7a7580f49..02acf6b46f6338 100644 --- a/lib/internal/bootstrap/pre_execution.js +++ b/lib/internal/bootstrap/pre_execution.js @@ -150,6 +150,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-bootstrap-modules.js b/test/parallel/test-bootstrap-modules.js index 73e47ed9d502e0..c20648f1a43918 100644 --- a/test/parallel/test-bootstrap-modules.js +++ b/test/parallel/test-bootstrap-modules.js @@ -10,7 +10,7 @@ const assert = require('assert'); const isMainThread = common.isMainThread; const kCoverageModuleCount = process.env.NODE_V8_COVERAGE ? 1 : 0; -const kMaxModuleCount = (isMainThread ? 64 : 86) + kCoverageModuleCount; +const kMaxModuleCount = (isMainThread ? 65 : 87) + kCoverageModuleCount; assert(list.length <= kMaxModuleCount, `Total length: ${list.length}\n` + list.join('\n') 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);