diff --git a/lib/repl.js b/lib/repl.js index c726065e3f..61855f9f4e 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -641,7 +641,7 @@ REPLServer.prototype.complete = function(line, callback) { group.sort(); for (var j = 0; j < group.length; j++) { c = group[j]; - if (!hasOwnProperty(c)) { + if (!hasOwnProperty(uniq, c)) { completions.push(c); uniq[c] = true; } diff --git a/test/simple/test-repl-tab-complete.js b/test/simple/test-repl-tab-complete.js index 591cd32e98..684063831b 100644 --- a/test/simple/test-repl-tab-complete.js +++ b/test/simple/test-repl-tab-complete.js @@ -55,6 +55,9 @@ putIn.run([ testMe.complete('inner.o', function(error, data) { assert.deepEqual(data, doesNotBreak); }); +testMe.complete('console.lo', function(error, data) { + assert.deepEqual(data, [['console.log'], 'console.lo']); +}); // Tab Complete will return globaly scoped variables putIn.run(['};']);