@@ -397,6 +397,45 @@ testMe.complete('obj.', common.mustCall((error, data) => {
397397 assert ( data [ 0 ] . includes ( 'obj.key' ) ) ;
398398} ) ) ;
399399
400+ // Tab completion for files/directories
401+ {
402+ putIn . run ( [ '.clear' ] ) ;
403+ process . chdir ( __dirname ) ;
404+
405+ const readFileSync = 'fs.readFileSync("' ;
406+ const fixturePath = `${ readFileSync } ../fixtures/test-repl-tab-completion` ;
407+ if ( ! common . isWindows ) {
408+ testMe . complete ( fixturePath , common . mustCall ( ( err , data ) => {
409+ assert . strictEqual ( err , null ) ;
410+ assert . ok ( data [ 0 ] [ 0 ] . includes ( '.hiddenfiles' ) ) ;
411+ assert . ok ( data [ 0 ] [ 1 ] . includes ( 'hellorandom.txt' ) ) ;
412+ assert . ok ( data [ 0 ] [ 2 ] . includes ( 'helloworld.js' ) ) ;
413+ } ) ) ;
414+
415+ testMe . complete ( `${ fixturePath } /hello` ,
416+ common . mustCall ( ( err , data ) => {
417+ assert . strictEqual ( err , null ) ;
418+ assert . ok ( data [ 0 ] [ 0 ] . includes ( 'hellorandom.txt' ) ) ;
419+ assert . ok ( data [ 0 ] [ 1 ] . includes ( 'helloworld.js' ) ) ;
420+ } )
421+ ) ;
422+
423+ testMe . complete ( `${ fixturePath } /.h` ,
424+ common . mustCall ( ( err , data ) => {
425+ assert . strictEqual ( err , null ) ;
426+ assert . ok ( data [ 0 ] [ 0 ] . includes ( '.hiddenfiles' ) ) ;
427+ } )
428+ ) ;
429+
430+ testMe . complete ( `${ readFileSync } ./xxxRandom/random` ,
431+ common . mustCall ( ( err , data ) => {
432+ assert . strictEqual ( err , null ) ;
433+ assert . strictEqual ( data [ 0 ] . length , 0 ) ;
434+ } )
435+ ) ;
436+ }
437+ }
438+
400439[
401440 Array ,
402441 Buffer ,
0 commit comments