summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/internal/bootstrap/node.js3
-rw-r--r--lib/internal/util/inspector.js2
-rw-r--r--src/node_config.cc12
-rw-r--r--test/common/index.js5
-rw-r--r--test/known_issues/test-inspector-cluster-port-clash.js2
-rw-r--r--test/parallel/test-cli-bad-options.js2
-rw-r--r--test/parallel/test-cli-node-print-help.js3
-rw-r--r--test/parallel/test-module-cjs-helpers.js4
-rw-r--r--test/parallel/test-process-env-allowed-flags.js2
-rw-r--r--test/parallel/test-process-features.js1
-rw-r--r--test/parallel/test-repl-tab-complete.js2
-rw-r--r--test/parallel/test-v8-coverage.js2
-rw-r--r--test/sequential/test-async-wrap-getasyncid.js3
-rw-r--r--test/sequential/test-inspector-has-inspector-false.js6
-rwxr-xr-xtools/test.py4
15 files changed, 25 insertions, 28 deletions
diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js
index 23d72547ae..6fa3f2b79d 100644
--- a/lib/internal/bootstrap/node.js
+++ b/lib/internal/bootstrap/node.js
@@ -268,12 +268,13 @@ process.assert = deprecate(
// TODO(joyeecheung): this property has not been well-maintained, should we
// deprecate it in favor of a better API?
-const { isDebugBuild, hasOpenSSL } = config;
+const { isDebugBuild, hasOpenSSL, hasInspector } = config;
Object.defineProperty(process, 'features', {
enumerable: true,
writable: false,
configurable: false,
value: {
+ inspector: hasInspector,
debug: isDebugBuild,
uv: true,
ipv6: true, // TODO(bnoordhuis) ping libuv
diff --git a/lib/internal/util/inspector.js b/lib/internal/util/inspector.js
index 68c20108bd..e237db16a6 100644
--- a/lib/internal/util/inspector.js
+++ b/lib/internal/util/inspector.js
@@ -3,8 +3,8 @@
let session;
function sendInspectorCommand(cb, onError) {
const { hasInspector } = internalBinding('config');
- const inspector = hasInspector ? require('inspector') : undefined;
if (!hasInspector) return onError();
+ const inspector = require('inspector');
if (session === undefined) session = new inspector.Session();
try {
session.connect();
diff --git a/src/node_config.cc b/src/node_config.cc
index 65ad48f349..56672308d1 100644
--- a/src/node_config.cc
+++ b/src/node_config.cc
@@ -57,18 +57,18 @@ static void Initialize(Local<Object> target,
READONLY_TRUE_PROPERTY(target, "hasTracing");
#endif
-#if HAVE_INSPECTOR
- READONLY_TRUE_PROPERTY(target, "hasInspector");
-#else
- READONLY_FALSE_PROPERTY(target, "hasInspector");
-#endif
-
#if !defined(NODE_WITHOUT_NODE_OPTIONS)
READONLY_TRUE_PROPERTY(target, "hasNodeOptions");
#endif
#endif // NODE_HAVE_I18N_SUPPORT
+#if HAVE_INSPECTOR
+ READONLY_TRUE_PROPERTY(target, "hasInspector");
+#else
+ READONLY_FALSE_PROPERTY(target, "hasInspector");
+#endif
+
if (env->abort_on_uncaught_exception())
READONLY_TRUE_PROPERTY(target, "shouldAbortOnUncaughtException");
diff --git a/test/common/index.js b/test/common/index.js
index eeaa5737db..8554b85fe8 100644
--- a/test/common/index.js
+++ b/test/common/index.js
@@ -80,8 +80,7 @@ if (process.argv.length === 2 &&
hasCrypto &&
// If the binary is build without `intl` the inspect option is
// invalid. The test itself should handle this case.
- (process.config.variables.v8_enable_inspector !== 0 ||
- !flag.startsWith('--inspect'))) {
+ (process.features.inspector || !flag.startsWith('--inspect'))) {
throw new Error(`Test has to be started with the flag: '${flag}'`);
}
}
@@ -618,7 +617,7 @@ function expectsError(fn, settings, exact) {
}
function skipIfInspectorDisabled() {
- if (process.config.variables.v8_enable_inspector === 0) {
+ if (!process.features.inspector) {
skip('V8 inspector is disabled');
}
}
diff --git a/test/known_issues/test-inspector-cluster-port-clash.js b/test/known_issues/test-inspector-cluster-port-clash.js
index 0333ffcb98..bc04e9907b 100644
--- a/test/known_issues/test-inspector-cluster-port-clash.js
+++ b/test/known_issues/test-inspector-cluster-port-clash.js
@@ -13,7 +13,7 @@ const assert = require('assert');
// This following check should be replaced by common.skipIfInspectorDisabled()
// if moved out of the known_issues directory.
-if (process.config.variables.v8_enable_inspector === 0) {
+if (!process.features.inspector) {
// When the V8 inspector is disabled, using either --without-inspector or
// --without-ssl, this test will not fail which it is expected to do.
// The following fail will allow this test to be skipped by failing it.
diff --git a/test/parallel/test-cli-bad-options.js b/test/parallel/test-cli-bad-options.js
index 7abd330aa4..3fc8980c14 100644
--- a/test/parallel/test-cli-bad-options.js
+++ b/test/parallel/test-cli-bad-options.js
@@ -6,7 +6,7 @@ require('../common');
const assert = require('assert');
const spawn = require('child_process').spawnSync;
-if (process.config.variables.v8_enable_inspector === 1) {
+if (process.features.inspector) {
requiresArgument('--inspect-port');
requiresArgument('--inspect-port=');
requiresArgument('--debug-port');
diff --git a/test/parallel/test-cli-node-print-help.js b/test/parallel/test-cli-node-print-help.js
index 433a95faf2..e115124b04 100644
--- a/test/parallel/test-cli-node-print-help.js
+++ b/test/parallel/test-cli-node-print-help.js
@@ -22,10 +22,9 @@ function startPrintHelpTest() {
}
function validateNodePrintHelp() {
- const config = process.config;
const HAVE_OPENSSL = common.hasCrypto;
const NODE_HAVE_I18N_SUPPORT = common.hasIntl;
- const HAVE_INSPECTOR = config.variables.v8_enable_inspector === 1;
+ const HAVE_INSPECTOR = process.features.inspector;
const cliHelpOptions = [
{ compileConstant: HAVE_OPENSSL,
diff --git a/test/parallel/test-module-cjs-helpers.js b/test/parallel/test-module-cjs-helpers.js
index ccf95f3e81..12de65598e 100644
--- a/test/parallel/test-module-cjs-helpers.js
+++ b/test/parallel/test-module-cjs-helpers.js
@@ -5,7 +5,5 @@ require('../common');
const assert = require('assert');
const { builtinLibs } = require('internal/modules/cjs/helpers');
-const hasInspector = process.config.variables.v8_enable_inspector === 1;
-
-const expectedLibs = hasInspector ? 34 : 33;
+const expectedLibs = process.features.inspector ? 34 : 33;
assert.strictEqual(builtinLibs.length, expectedLibs);
diff --git a/test/parallel/test-process-env-allowed-flags.js b/test/parallel/test-process-env-allowed-flags.js
index dfa2129b26..ad0e05f69b 100644
--- a/test/parallel/test-process-env-allowed-flags.js
+++ b/test/parallel/test-process-env-allowed-flags.js
@@ -16,7 +16,7 @@ require('../common');
'r',
'--stack-trace-limit=100',
'--stack-trace-limit=-=xX_nodejs_Xx=-',
- ].concat(process.config.variables.v8_enable_inspector ? [
+ ].concat(process.features.inspector ? [
'--inspect-brk',
'inspect-brk',
'--inspect_brk',
diff --git a/test/parallel/test-process-features.js b/test/parallel/test-process-features.js
index 7752cc53b2..a24d366ba8 100644
--- a/test/parallel/test-process-features.js
+++ b/test/parallel/test-process-features.js
@@ -6,6 +6,7 @@ const assert = require('assert');
const keys = new Set(Object.keys(process.features));
assert.deepStrictEqual(keys, new Set([
+ 'inspector',
'debug',
'uv',
'ipv6',
diff --git a/test/parallel/test-repl-tab-complete.js b/test/parallel/test-repl-tab-complete.js
index 69011e4af8..4c68ec2c8f 100644
--- a/test/parallel/test-repl-tab-complete.js
+++ b/test/parallel/test-repl-tab-complete.js
@@ -29,7 +29,7 @@ const {
} = require('../common/hijackstdio');
const assert = require('assert');
const fixtures = require('../common/fixtures');
-const hasInspector = process.config.variables.v8_enable_inspector === 1;
+const hasInspector = process.features.inspector;
if (!common.isMainThread)
common.skip('process.chdir is not available in Workers');
diff --git a/test/parallel/test-v8-coverage.js b/test/parallel/test-v8-coverage.js
index a7a318c34d..3db8b81d55 100644
--- a/test/parallel/test-v8-coverage.js
+++ b/test/parallel/test-v8-coverage.js
@@ -1,6 +1,6 @@
'use strict';
-if (!process.config.variables.v8_enable_inspector) return;
+if (!process.features.inspector) return;
const common = require('../common');
const assert = require('assert');
diff --git a/test/sequential/test-async-wrap-getasyncid.js b/test/sequential/test-async-wrap-getasyncid.js
index 6a6bf1b407..a5e2bf64d8 100644
--- a/test/sequential/test-async-wrap-getasyncid.js
+++ b/test/sequential/test-async-wrap-getasyncid.js
@@ -289,8 +289,7 @@ if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check
testInitialized(req, 'SendWrap');
}
-if (process.config.variables.v8_enable_inspector !== 0 &&
- common.isMainThread) {
+if (process.features.inspector && common.isMainThread) {
const binding = internalBinding('inspector');
const handle = new binding.Connection(() => {});
testInitialized(handle, 'Connection');
diff --git a/test/sequential/test-inspector-has-inspector-false.js b/test/sequential/test-inspector-has-inspector-false.js
index cdb7ca9e19..56a50408bb 100644
--- a/test/sequential/test-inspector-has-inspector-false.js
+++ b/test/sequential/test-inspector-has-inspector-false.js
@@ -3,10 +3,10 @@
const common = require('../common');
-// This is to ensure that the sendInspectorCommand function calls the error
-// function if its called with the v8_enable_inspector is disabled
+if (process.features.inspector) {
+ common.skip('V8 inspector is enabled');
+}
-process.config.variables.v8_enable_inspector = 0;
const inspector = require('internal/util/inspector');
inspector.sendInspectorCommand(
diff --git a/tools/test.py b/tools/test.py
index 4ac8d0e631..b9750b2035 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -1653,8 +1653,8 @@ def Main():
# We want to skip the inspector tests if node was built without the inspector.
has_inspector = Execute([vm,
- '-p', 'process.config.variables.v8_enable_inspector'], context)
- if has_inspector.stdout.rstrip() == '0':
+ '-p', 'process.features.inspector'], context)
+ if has_inspector.stdout.rstrip() == 'false':
context.v8_enable_inspector = False
has_crypto = Execute([vm,