repl: fix bug in fs module autocompletion
PR-URL: https://github.com/nodejs/node/pull/29555 Fixes: https://github.com/nodejs/node/issues/29424 Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
parent
3f3ad38c87
commit
2f497a67ad
@ -1193,7 +1193,7 @@ function complete(line, callback) {
|
||||
d.name.startsWith(baseName))
|
||||
.map((d) => d.name);
|
||||
completionGroups.push(filteredValue);
|
||||
completeOn = filePath;
|
||||
completeOn = baseName;
|
||||
} catch {}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ const {
|
||||
restoreStderr
|
||||
} = require('../common/hijackstdio');
|
||||
const assert = require('assert');
|
||||
const path = require('path');
|
||||
const fixtures = require('../common/fixtures');
|
||||
const hasInspector = process.features.inspector;
|
||||
|
||||
@ -434,6 +435,16 @@ testMe.complete('obj.', common.mustCall((error, data) => {
|
||||
assert.strictEqual(data[0].length, 0);
|
||||
})
|
||||
);
|
||||
|
||||
const testPath = fixturePath.slice(0, -1);
|
||||
testMe.complete(testPath, common.mustCall((err, data) => {
|
||||
assert.strictEqual(err, null);
|
||||
assert.ok(data[0][0].includes('test-repl-tab-completion'));
|
||||
assert.strictEqual(
|
||||
data[1],
|
||||
path.basename(testPath)
|
||||
);
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user