@@ -4,24 +4,24 @@ const common = require('../common');
4
4
const assert = require ( 'assert' ) ;
5
5
const repl = require ( 'repl' ) ;
6
6
7
- var referenceErrorCount = 0 ;
8
-
9
- common . ArrayStream . prototype . write = function ( msg ) {
10
- if ( msg . startsWith ( 'ReferenceError: ' ) ) {
11
- referenceErrorCount ++ ;
12
- }
13
- } ;
7
+ common . ArrayStream . prototype . write = function ( msg ) { } ;
14
8
15
9
const putIn = new common . ArrayStream ( ) ;
16
10
const testMe = repl . start ( '' , putIn ) ;
17
11
18
12
// https://github.com/nodejs/node/issues/3346
19
- // Tab-completion for an undefined variable inside a function should report a
20
- // ReferenceError.
13
+ // Tab-completion should be empty
21
14
putIn . run ( [ '.clear' ] ) ;
22
15
putIn . run ( [ 'function () {' ] ) ;
23
- testMe . complete ( 'arguments.' ) ;
16
+ testMe . complete ( 'arguments.' , common . mustCall ( ( err , completions ) => {
17
+ assert . strictEqual ( err , null ) ;
18
+ assert . deepStrictEqual ( completions , [ [ ] , 'arguments.' ] ) ;
19
+ } ) ) ;
24
20
25
- process . on ( 'exit' , function ( ) {
26
- assert . strictEqual ( referenceErrorCount , 1 ) ;
27
- } ) ;
21
+ putIn . run ( [ '.clear' ] ) ;
22
+ putIn . run ( [ 'function () {' ] ) ;
23
+ putIn . run ( [ 'undef;' ] ) ;
24
+ testMe . complete ( 'undef.' , common . mustCall ( ( err , completions ) => {
25
+ assert . strictEqual ( err , null ) ;
26
+ assert . deepStrictEqual ( completions , [ [ ] , 'undef.' ] ) ;
27
+ } ) ) ;
0 commit comments