| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8c864de commit 71a4b24
12 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,10 +5,12 @@ const os = require('os'); | |||
| 5 | 5 | const cp = require('child_process'); | |
| 6 | 6 | ||
| 7 | 7 | if (process.argv[2] === 'child') { | |
| 8 | + const { internalBinding } = require('internal/test/binding'); | ||
| 8 | 9 | // This is the heart of the test. | |
| 9 | - new (process.binding('zlib').Zlib)(0).init(1, 2, 3, 4, 5); | ||
| 10 | + new (internalBinding('zlib').Zlib)(0).init(1, 2, 3, 4, 5); | ||
| 10 | 11 | } else { | |
| 11 | - const child = cp.spawnSync(`${process.execPath}`, [`${__filename}`, 'child']); | ||
| 12 | + const child = cp.spawnSync( | ||
| 13 | + `${process.execPath}`, ['--expose-internals', `${__filename}`, 'child']); | ||
| 12 | 14 | ||
| 13 | 15 | assert.strictEqual(child.stdout.toString(), ''); | |
| 14 | 16 | assert.ok(child.stderr.includes( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ const hooks = initHooks(); | |||
| 11 | 11 | hooks.enable(); | |
| 12 | 12 | const { internalBinding } = require('internal/test/binding'); | |
| 13 | 13 | const { Zlib } = internalBinding('zlib'); | |
| 14 | - const constants = internalBinding('constants').zlib; | ||
| 14 | + const constants = require('zlib').constants; | ||
| 15 | 15 | ||
| 16 | 16 | const handle = new Zlib(constants.DEFLATE); | |
| 17 | 17 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,10 +29,9 @@ const os = require('os'); | |||
| 29 | 29 | const { exec, execSync, spawnSync } = require('child_process'); | |
| 30 | 30 | const util = require('util'); | |
| 31 | 31 | const tmpdir = require('./tmpdir'); | |
| 32 | - const { | ||
| 33 | - bits, | ||
| 34 | - hasIntl | ||
| 35 | - } = process.binding('config'); | ||
| 32 | + const bits = ['arm64', 'mips', 'mipsel', 'ppc64', 's390x', 'x64'] | ||
| 33 | + .includes(process.arch) ? 64 : 32; | ||
| 34 | + const hasIntl = !!process.config.variables.v8_enable_i18n_support; | ||
| 36 | 35 | const { isMainThread } = require('worker_threads'); | |
| 37 | 36 | ||
| 38 | 37 | // Some tests assume a umask of 0o022 so set that up front. Tests that need a | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -314,7 +314,7 @@ class InspectorSession { | |||
| 314 | 314 | } | |
| 315 | 315 | ||
| 316 | 316 | class NodeInstance extends EventEmitter { | |
| 317 | - constructor(inspectorFlags = ['--inspect-brk=0'], | ||
| 317 | + constructor(inspectorFlags = ['--inspect-brk=0', '--expose-internals'], | ||
| 318 | 318 | scriptContents = '', | |
| 319 | 319 | scriptFile = _MAINSCRIPT) { | |
| 320 | 320 | super(); | |
@@ -348,7 +348,8 @@ class NodeInstance extends EventEmitter { | |||
| 348 | 348 | ||
| 349 | 349 | static async startViaSignal(scriptContents) { | |
| 350 | 350 | const instance = new NodeInstance( | |
| 351 | - [], `${scriptContents}\nprocess._rawDebug('started');`, undefined); | ||
| 351 | + ['--expose-internals'], | ||
| 352 | + `${scriptContents}\nprocess._rawDebug('started');`, undefined); | ||
| 352 | 353 | const msg = 'Timed out waiting for process to start'; | |
| 353 | 354 | while (await fires(instance.nextStderrString(), msg, TIMEOUT) !== | |
| 354 | 355 | 'started') {} | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,10 +1,5 @@ | |||
| 1 | 1 | import module from 'module'; | |
| 2 | 2 | ||
| 3 | - const builtins = new Set( | ||
| 4 | - Object.keys(process.binding('natives')).filter(str => | ||
| 5 | - /^(?!(?:internal|node|v8)\/)/.test(str)) | ||
| 6 | - ); | ||
| 7 | - | ||
| 8 | 3 | export function dynamicInstantiate(url) { | |
| 9 | 4 | const builtinInstance = module._load(url.substr(5)); | |
| 10 | 5 | const builtinExports = ['default', ...Object.keys(builtinInstance)]; | |
@@ -19,7 +14,7 @@ export function dynamicInstantiate(url) { | |||
| 19 | 14 | } | |
| 20 | 15 | ||
| 21 | 16 | export function resolve(specifier, base, defaultResolver) { | |
| 22 | - if (builtins.has(specifier)) { | ||
| 17 | + if (module.builtinModules.includes(specifier)) { | ||
| 23 | 18 | return { | |
| 24 | 19 | url: `node:${specifier}`, | |
| 25 | 20 | format: 'dynamic' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,18 +1,15 @@ | |||
| 1 | 1 | import url from 'url'; | |
| 2 | 2 | import path from 'path'; | |
| 3 | 3 | import process from 'process'; | |
| 4 | + import { builtinModules } from 'module'; | ||
| 4 | 5 | ||
| 5 | - const builtins = new Set( | ||
| 6 | - Object.keys(process.binding('natives')).filter((str) => | ||
| 7 | - /^(?!(?:internal|node|v8)\/)/.test(str)) | ||
| 8 | - ); | ||
| 9 | 6 | const JS_EXTENSIONS = new Set(['.js', '.mjs']); | |
| 10 | 7 | ||
| 11 | 8 | const baseURL = new url.URL('file://'); | |
| 12 | 9 | baseURL.pathname = process.cwd() + '/'; | |
| 13 | 10 | ||
| 14 | 11 | export function resolve(specifier, parentModuleURL = baseURL /*, defaultResolve */) { | |
| 15 | - if (builtins.has(specifier)) { | ||
| 12 | + if (builtinModules.includes(specifier)) { | ||
| 16 | 13 | return { | |
| 17 | 14 | url: specifier, | |
| 18 | 15 | format: 'builtin' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,15 +1,11 @@ | |||
| 1 | 1 | import { URL } from 'url'; | |
| 2 | - | ||
| 3 | - const builtins = new Set( | ||
| 4 | - Object.keys(process.binding('natives')).filter(str => | ||
| 5 | - /^(?!(?:internal|node|v8)\/)/.test(str)) | ||
| 6 | - ) | ||
| 2 | + import { builtinModules } from 'module'; | ||
| 7 | 3 | ||
| 8 | 4 | const baseURL = new URL('file://'); | |
| 9 | 5 | baseURL.pathname = process.cwd() + '/'; | |
| 10 | 6 | ||
| 11 | 7 | export function resolve (specifier, base = baseURL) { | |
| 12 | - if (builtins.has(specifier)) { | ||
| 8 | + if (builtinModules.includes(specifier)) { | ||
| 13 | 9 | return { | |
| 14 | 10 | url: specifier, | |
| 15 | 11 | format: 'builtin' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,8 +3,12 @@ | |||
| 3 | 3 | ||
| 4 | 4 | const common = require('../common'); | |
| 5 | 5 | ||
| 6 | - if (!process.binding('config').hasTracing) | ||
| 6 | + try { | ||
| 7 | + require('trace_events'); | ||
| 8 | + } catch { | ||
| 7 | 9 | common.skip('missing trace events'); | |
| 10 | + } | ||
| 11 | + | ||
| 8 | 12 | common.skipIfWorker(); // https://github.com/nodejs/node/issues/22767 | |
| 9 | 13 | ||
| 10 | 14 | const assert = require('assert'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,11 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | 3 | const common = require('../common'); | |
| 4 | - if (!process.binding('config').hasTracing) | ||
| 4 | + try { | ||
| 5 | + require('trace_events'); | ||
| 6 | + } catch { | ||
| 5 | 7 | common.skip('missing trace events'); | |
| 8 | + } | ||
| 6 | 9 | ||
| 7 | 10 | const assert = require('assert'); | |
| 8 | 11 | const cp = require('child_process'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,11 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | 3 | const common = require('../common'); | |
| 4 | - if (!process.binding('config').hasTracing) | ||
| 4 | + try { | ||
| 5 | + require('trace_events'); | ||
| 6 | + } catch { | ||
| 5 | 7 | common.skip('missing trace events'); | |
| 8 | + } | ||
| 6 | 9 | ||
| 7 | 10 | const assert = require('assert'); | |
| 8 | 11 | const cp = require('child_process'); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments