From 5f3f64800086636eb2a13d143ce19ebdd1488aad Mon Sep 17 00:00:00 2001 From: Andres Monge Date: Fri, 12 Oct 2018 09:41:57 -0700 Subject: [PATCH] lib: migrate from process.binding to internalBinding We are migrating towards using internalBinding(\'options\').getOptions() instead of process.binding(\'config\') to access the value of the --experimental-vm-modules command line option. PR-URL: https://github.com/nodejs/node/pull/23586 Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- lib/vm.js | 2 +- .../test-inspector-has-inspector-false.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 test/sequential/test-inspector-has-inspector-false.js diff --git a/lib/vm.js b/lib/vm.js index f29a805fd3cd5b..720d46ea1abdcd 100644 --- a/lib/vm.js +++ b/lib/vm.js @@ -402,7 +402,7 @@ module.exports = { compileFunction, }; -if (process.binding('config').experimentalVMModules) { +if (internalBinding('options').getOptions('--experimental-vm-modules')) { const { SourceTextModule } = require('internal/vm/source_text_module'); module.exports.SourceTextModule = SourceTextModule; } diff --git a/test/sequential/test-inspector-has-inspector-false.js b/test/sequential/test-inspector-has-inspector-false.js new file mode 100644 index 00000000000000..cdb7ca9e19e79b --- /dev/null +++ b/test/sequential/test-inspector-has-inspector-false.js @@ -0,0 +1,15 @@ +// Flags: --expose-internals +'use strict'; + +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 + +process.config.variables.v8_enable_inspector = 0; +const inspector = require('internal/util/inspector'); + +inspector.sendInspectorCommand( + common.mustNotCall('Inspector callback should not be called'), + common.mustCall(1), +);