Skip to content

Commit

Permalink
repl: fix tab completion of inspector module
Browse files Browse the repository at this point in the history
Correctly check for the presence of the inspector module before adding
it to the builtin libs list.

PR-URL: #19505
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
targos committed Mar 23, 2018
1 parent c6c957d commit a6f3e8f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
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);

0 comments on commit a6f3e8f

Please sign in to comment.