summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTeddy Katz <teddy.katz@gmail.com>2017-08-09 21:51:56 -0700
committerTeddy Katz <teddy.katz@gmail.com>2017-08-13 01:03:30 -0700
commitb646a3df29d85107cd49d5970dcf1cf286d9def8 (patch)
tree490a436d6f40e8d62b6b09611623318af27fe6d6 /test
parent50235a03ef0dafd9738766643cd0e0266eafd4e6 (diff)
downloadandroid-node-v8-b646a3df29d85107cd49d5970dcf1cf286d9def8.tar.gz
android-node-v8-b646a3df29d85107cd49d5970dcf1cf286d9def8.tar.bz2
android-node-v8-b646a3df29d85107cd49d5970dcf1cf286d9def8.zip
repl: include folder extensions in autocomplete
When autocompleting `require` calls, the repl strips .js file extensions from results. However, stripping an extension from a directory results in an error. Update the autocompletion logic to avoid stripping extensions from directories. PR-URL: https://github.com/nodejs/node/pull/14727 Fixes: https://github.com/nodejs/node/issues/14726 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/repl-folder-extensions/foo.js/index.js0
-rw-r--r--test/parallel/test-repl-tab-complete.js10
2 files changed, 10 insertions, 0 deletions
diff --git a/test/fixtures/repl-folder-extensions/foo.js/index.js b/test/fixtures/repl-folder-extensions/foo.js/index.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/fixtures/repl-folder-extensions/foo.js/index.js
diff --git a/test/parallel/test-repl-tab-complete.js b/test/parallel/test-repl-tab-complete.js
index 85bcaf9e61..da8db7a57b 100644
--- a/test/parallel/test-repl-tab-complete.js
+++ b/test/parallel/test-repl-tab-complete.js
@@ -279,6 +279,16 @@ testMe.complete('require(\'n', common.mustCall(function(error, data) {
});
});
+ {
+ const path = '../fixtures/repl-folder-extensions/f';
+ testMe.complete(`require('${path}`, common.mustCall((err, data) => {
+ assert.ifError(err);
+ assert.strictEqual(data.length, 2);
+ assert.strictEqual(data[1], path);
+ assert.ok(data[0].includes('../fixtures/repl-folder-extensions/foo.js'));
+ }));
+ }
+
process.chdir(cwd);
}