Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
repl: fix tab completion of inspector module
Correctly check for the presence of the inspector module before adding
it to the builtin libs list.
  • Loading branch information
targos committed Mar 21, 2018
commit e4b4855654375ee459256e6251d65c4038a4c6e2
2 changes: 1 addition & 1 deletion lib/internal/modules/cjs/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const builtinLibs = [
'stream', 'string_decoder', 'tls', 'tty', 'url', 'util', 'v8', 'vm', 'zlib'
];

if (typeof process.binding('inspector').connect === 'function') {
if (typeof process.binding('inspector').open === 'function') {
builtinLibs.push('inspector');
builtinLibs.sort();
}
Expand Down
11 changes: 11 additions & 0 deletions test/parallel/test-module-cjs-helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';
// Flags: --expose-internals

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 ? 32 : 31;
assert.strictEqual(builtinLibs.length, expectedLibs);