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 <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
targos committed Mar 30, 2018
1 parent cae9ff2 commit ee4390a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/internal/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,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/module');

const hasInspector = process.config.variables.v8_enable_inspector === 1;

const expectedLibs = hasInspector ? 32 : 31;
assert.strictEqual(builtinLibs.length, expectedLibs);

0 comments on commit ee4390a

Please sign in to comment.