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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
c6c957d3cc
commit
a6f3e8f3fe
@ -104,7 +104,7 @@ const builtinLibs = [
|
|||||||
'stream', 'string_decoder', 'tls', 'tty', 'url', 'util', 'v8', 'vm', 'zlib'
|
'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.push('inspector');
|
||||||
builtinLibs.sort();
|
builtinLibs.sort();
|
||||||
}
|
}
|
||||||
|
11
test/parallel/test-module-cjs-helpers.js
Normal file
11
test/parallel/test-module-cjs-helpers.js
Normal file
@ -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);
|
Loading…
x
Reference in New Issue
Block a user