diff --git a/test/async-hooks/test-zlib.zlib-binding.deflate.js b/test/async-hooks/test-zlib.zlib-binding.deflate.js index 972052b2d570a5..21fd0af7da5e5a 100644 --- a/test/async-hooks/test-zlib.zlib-binding.deflate.js +++ b/test/async-hooks/test-zlib.zlib-binding.deflate.js @@ -11,7 +11,7 @@ const hooks = initHooks(); hooks.enable(); const { internalBinding } = require('internal/test/binding'); const { Zlib } = internalBinding('zlib'); -const constants = process.binding('constants').zlib; +const constants = internalBinding('constants').zlib; const handle = new Zlib(constants.DEFLATE); diff --git a/test/parallel/test-accessor-properties.js b/test/parallel/test-accessor-properties.js index 95b960b202cd53..463118593ff2a3 100644 --- a/test/parallel/test-accessor-properties.js +++ b/test/parallel/test-accessor-properties.js @@ -57,7 +57,7 @@ const UDP = internalBinding('udp_wrap').UDP; if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check // There are accessor properties in crypto too - const crypto = process.binding('crypto'); + const crypto = internalBinding('crypto'); assert.throws(() => { crypto.SecureContext.prototype._external; diff --git a/test/parallel/test-binding-constants.js b/test/parallel/test-binding-constants.js index 9855af19422882..e989e09b3cd7d6 100644 --- a/test/parallel/test-binding-constants.js +++ b/test/parallel/test-binding-constants.js @@ -1,7 +1,9 @@ +// Flags: --expose-internals 'use strict'; require('../common'); -const constants = process.binding('constants'); +const { internalBinding } = require('internal/test/binding'); +const constants = internalBinding('constants'); const assert = require('assert'); assert.deepStrictEqual( diff --git a/test/parallel/test-child-process-spawnsync-kill-signal.js b/test/parallel/test-child-process-spawnsync-kill-signal.js index 90222e04c97c9e..b014a384f65f37 100644 --- a/test/parallel/test-child-process-spawnsync-kill-signal.js +++ b/test/parallel/test-child-process-spawnsync-kill-signal.js @@ -9,7 +9,7 @@ if (process.argv[2] === 'child') { } else { const internalCp = require('internal/child_process'); const oldSpawnSync = internalCp.spawnSync; - const { SIGKILL } = process.binding('constants').os.signals; + const { SIGKILL } = require('os').constants.signals; function spawn(killSignal, beforeSpawn) { if (beforeSpawn) { diff --git a/test/parallel/test-child-process-spawnsync-validation-errors.js b/test/parallel/test-child-process-spawnsync-validation-errors.js index 17545d4af7bf50..9c8a409c752d04 100644 --- a/test/parallel/test-child-process-spawnsync-validation-errors.js +++ b/test/parallel/test-child-process-spawnsync-validation-errors.js @@ -2,7 +2,7 @@ const common = require('../common'); const assert = require('assert'); const spawnSync = require('child_process').spawnSync; -const signals = process.binding('constants').os.signals; +const signals = require('os').constants.signals; const rootUser = common.isWindows ? false : process.getuid() === 0; const invalidArgTypeError = common.expectsError( diff --git a/test/parallel/test-constants.js b/test/parallel/test-constants.js index e68f972d36aa9a..62c62b101a10a8 100644 --- a/test/parallel/test-constants.js +++ b/test/parallel/test-constants.js @@ -1,7 +1,9 @@ +// Flags: --expose_internals 'use strict'; require('../common'); -const binding = process.binding('constants'); +const { internalBinding } = require('internal/test/binding'); +const binding = internalBinding('constants'); const constants = require('constants'); const assert = require('assert'); diff --git a/test/parallel/test-dgram-bind-fd.js b/test/parallel/test-dgram-bind-fd.js index 8c81cb118c1001..a1382d93ff3889 100644 --- a/test/parallel/test-dgram-bind-fd.js +++ b/test/parallel/test-dgram-bind-fd.js @@ -8,7 +8,7 @@ const assert = require('assert'); const dgram = require('dgram'); const { internalBinding } = require('internal/test/binding'); const { UDP } = internalBinding('udp_wrap'); -const { UV_UDP_REUSEADDR } = process.binding('constants').os; +const { UV_UDP_REUSEADDR } = require('os').constants; const BUFFER_SIZE = 4096; diff --git a/test/parallel/test-fs-readdir-types.js b/test/parallel/test-fs-readdir-types.js index fa179eccfe26eb..96a3b73098728d 100644 --- a/test/parallel/test-fs-readdir-types.js +++ b/test/parallel/test-fs-readdir-types.js @@ -1,3 +1,4 @@ +// Flags: --expose-internals 'use strict'; const common = require('../common'); @@ -6,11 +7,12 @@ const fs = require('fs'); const tmpdir = require('../common/tmpdir'); -const binding = process.binding('fs'); +const { internalBinding } = require('internal/test/binding'); +const binding = internalBinding('fs'); const readdirDir = tmpdir.path; const files = ['empty', 'files', 'for', 'just', 'testing']; -const constants = process.binding('constants').fs; +const constants = require('fs').constants; const types = { isDirectory: constants.UV_DIRENT_DIR, isFile: constants.UV_DIRENT_FILE, diff --git a/test/parallel/test-loaders-hidden-from-users.js b/test/parallel/test-loaders-hidden-from-users.js index 0d752f5718b729..705faa2994c6e8 100644 --- a/test/parallel/test-loaders-hidden-from-users.js +++ b/test/parallel/test-loaders-hidden-from-users.js @@ -16,7 +16,8 @@ common.expectsError( common.expectsError( () => { const source = 'module.exports = require("internal/bootstrap/loaders")'; - process.binding('natives').owo = source; + const { internalBinding } = require('internal/test/binding'); + internalBinding('natives').owo = source; require('owo'); }, { code: 'MODULE_NOT_FOUND', diff --git a/test/parallel/test-process-binding-internalbinding-whitelist.js b/test/parallel/test-process-binding-internalbinding-whitelist.js index 044757e98dc402..9768ef66741aa3 100644 --- a/test/parallel/test-process-binding-internalbinding-whitelist.js +++ b/test/parallel/test-process-binding-internalbinding-whitelist.js @@ -1,21 +1,41 @@ // Flags: --no-warnings 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); // Assert that whitelisted internalBinding modules are accessible via // process.binding(). -assert(process.binding('uv')); -assert(process.binding('http_parser')); -assert(process.binding('v8')); -assert(process.binding('stream_wrap')); -assert(process.binding('signal_wrap')); -assert(process.binding('contextify')); -assert(process.binding('url')); -assert(process.binding('spawn_sync')); -assert(process.binding('js_stream')); +assert(process.binding('async_wrap')); assert(process.binding('buffer')); +assert(process.binding('cares_wrap')); +assert(process.binding('constants')); +assert(process.binding('contextify')); +if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check + assert(process.binding('crypto')); +} assert(process.binding('fs')); +assert(process.binding('fs_event_wrap')); +assert(process.binding('http_parser')); +if (common.hasIntl) { + assert(process.binding('icu')); +} assert(process.binding('inspector')); +assert(process.binding('js_stream')); +assert(process.binding('natives')); assert(process.binding('os')); +assert(process.binding('pipe_wrap')); +assert(process.binding('signal_wrap')); +assert(process.binding('spawn_sync')); +assert(process.binding('stream_wrap')); +assert(process.binding('tcp_wrap')); +if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check + assert(process.binding('tls_wrap')); +} +assert(process.binding('tty_wrap')); +assert(process.binding('udp_wrap')); +assert(process.binding('url')); +assert(process.binding('util')); +assert(process.binding('uv')); +assert(process.binding('v8')); +assert(process.binding('zlib')); diff --git a/test/parallel/test-process-constants-noatime.js b/test/parallel/test-process-constants-noatime.js index d0c027f0b9353d..bd1a848ed7aa74 100644 --- a/test/parallel/test-process-constants-noatime.js +++ b/test/parallel/test-process-constants-noatime.js @@ -2,11 +2,11 @@ const common = require('../common'); const assert = require('assert'); -const constants = process.binding('constants'); +const constants = require('fs').constants; if (common.isLinux) { - assert('O_NOATIME' in constants.fs); - assert.strictEqual(constants.fs.O_NOATIME, 0x40000); + assert('O_NOATIME' in constants); + assert.strictEqual(constants.O_NOATIME, 0x40000); } else { - assert(!('O_NOATIME' in constants.fs)); + assert(!('O_NOATIME' in constants)); } diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 10388ff78c60bd..5a626fe3a83b34 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -23,7 +23,7 @@ const common = require('../common'); const assert = require('assert'); const { internalBinding } = require('internal/test/binding'); -const JSStream = process.binding('js_stream').JSStream; +const JSStream = internalBinding('js_stream').JSStream; const util = require('util'); const vm = require('vm'); const { previewEntries } = internalBinding('util');