Skip to content
Browse files

test: reduce brittleness of tab complete test

test-repl-tab-complete includes tests that ensure that certain keys do
not appear in tab completions or that completion does not crash the
repl. It performed these tests by comparing completion output to a
hardcoded list of expected keys. This list is made incorrect by any api
changes that occur when new versions of V8 are introduced.

With this change, we assert that the specific keys to be avoided are
not present in the output instead.

PR-URL: #5772
Reviewed-By: Rich Trott <>
Reviewed-By: Colin Ihrig <>
Reviewed-By: James M Snell <>

  • Loading branch information...
Matt Loring authored and Fishrock123 committed Mar 17, 2016
1 parent d3654d8 commit 21770c380605a2b43109975d56a5ffafc85597f2
Showing with 6 additions and 61 deletions.
  1. +6 −61 test/parallel/test-repl-tab-complete.js
@@ -230,79 +230,24 @@[

testMe.complete('proxy.', common.mustCall(function(error, data) {
assert.strictEqual(error, null);
assert.deepEqual(data, [[], 'proxy.']);

// Make sure tab completion does not include integer members of an Array
var array_elements = [ [
'ary.unshift' ],
'ary.'];['.clear']);['var ary = [1,2,3];']);
testMe.complete('ary.', common.mustCall(function(error, data) {
assert.deepEqual(data, array_elements);
assert.strictEqual(data[0].indexOf('ary.0'), -1);
assert.strictEqual(data[0].indexOf('ary.1'), -1);
assert.strictEqual(data[0].indexOf('ary.2'), -1);

// Make sure tab completion does not include integer keys in an object
var obj_elements = [ [
'obj.a' ],
'obj.' ];['.clear']);['var obj = {1:"a","1a":"b",a:"b"};']);

testMe.complete('obj.', common.mustCall(function(error, data) {
assert.deepEqual(data, obj_elements);
assert.strictEqual(data[0].indexOf('obj.1'), -1);
assert.strictEqual(data[0].indexOf('obj.1a'), -1);
assert.notStrictEqual(data[0].indexOf('obj.a'), -1);

0 comments on commit 21770c3

Please sign in to comment.
You can’t perform that action at this time.