diff --git a/lib/repl.js b/lib/repl.js index 982af76f5e0..5ca927a58fb 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -589,6 +589,8 @@ REPLServer.prototype.complete = function(line, callback) { } else { completionGroupsLoaded(); } + } else { + completionGroupsLoaded(); } // Will be called when all completionGroups are in place diff --git a/test/simple/test-repl-tab-complete.js b/test/simple/test-repl-tab-complete.js index f183b92db85..1490598e909 100644 --- a/test/simple/test-repl-tab-complete.js +++ b/test/simple/test-repl-tab-complete.js @@ -190,3 +190,15 @@ putIn.run([ testMe.complete('str.len', function(error, data) { assert.deepEqual(data, [['str.length'], 'str.len']); }); + +putIn.run(['.clear']); + +// tab completion should not break on spaces +var spaceTimeout = setTimeout(function() { + throw new Error('timeout'); +}, 1000); + +testMe.complete(' ', function(error, data) { + assert.deepEqual(data, [[],undefined]); + clearTimeout(spaceTimeout); +});