Skip to content

Commit a6f3e8f

Browse files
committed
repl: fix tab completion of inspector module
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]>
1 parent c6c957d commit a6f3e8f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/internal/modules/cjs/helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const builtinLibs = [
104104
'stream', 'string_decoder', 'tls', 'tty', 'url', 'util', 'v8', 'vm', 'zlib'
105105
];
106106

107-
if (typeof process.binding('inspector').connect === 'function') {
107+
if (typeof process.binding('inspector').open === 'function') {
108108
builtinLibs.push('inspector');
109109
builtinLibs.sort();
110110
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict';
2+
// Flags: --expose-internals
3+
4+
require('../common');
5+
const assert = require('assert');
6+
const { builtinLibs } = require('internal/modules/cjs/helpers');
7+
8+
const hasInspector = process.config.variables.v8_enable_inspector === 1;
9+
10+
const expectedLibs = hasInspector ? 32 : 31;
11+
assert.strictEqual(builtinLibs.length, expectedLibs);

0 commit comments

Comments
 (0)