File tree 1 file changed +40
-8
lines changed
1 file changed +40
-8
lines changed Original file line number Diff line number Diff line change @@ -31,23 +31,23 @@ common.skipIfDumbTerminal();
31
31
const width = getStringWidth ( char ) - 1 ;
32
32
33
33
class FakeInput extends EventEmitter {
34
- columns = ( ( width + 1 ) * 10 + ( lineBreak ? 0 : 10 ) ) * 3
34
+ columns = ( ( width + 1 ) * 10 + ( lineBreak ? 0 : 10 ) ) * 3
35
35
36
- write = common . mustCall ( ( data ) => {
37
- output += data ;
38
- } , 6 )
36
+ write = common . mustCall ( ( data ) => {
37
+ output += data ;
38
+ } , 6 )
39
39
40
- resume ( ) { }
41
- pause ( ) { }
42
- end ( ) { }
40
+ resume ( ) { }
41
+ pause ( ) { }
42
+ end ( ) { }
43
43
}
44
44
45
45
const fi = new FakeInput ( ) ;
46
46
const rli = new readline . Interface ( {
47
47
input : fi ,
48
48
output : fi ,
49
49
terminal : true ,
50
- completer : completer
50
+ completer : common . mustCallAtLeast ( completer ) ,
51
51
} ) ;
52
52
53
53
const last = '\r\nFirst group\r\n\r\n' +
@@ -68,3 +68,35 @@ common.skipIfDumbTerminal();
68
68
rli . close ( ) ;
69
69
} ) ;
70
70
} ) ;
71
+
72
+ {
73
+ let output = '' ;
74
+ class FakeInput extends EventEmitter {
75
+ columns = 80
76
+
77
+ write = common . mustCall ( ( data ) => {
78
+ output += data ;
79
+ } , 1 )
80
+
81
+ resume ( ) { }
82
+ pause ( ) { }
83
+ end ( ) { }
84
+ }
85
+
86
+ const fi = new FakeInput ( ) ;
87
+ const rli = new readline . Interface ( {
88
+ input : fi ,
89
+ output : fi ,
90
+ terminal : true ,
91
+ completer :
92
+ common . mustCallAtLeast ( ( _ , cb ) => cb ( new Error ( 'message' ) ) ) ,
93
+ } ) ;
94
+
95
+ rli . on ( 'line' , common . mustNotCall ( ) ) ;
96
+ fi . emit ( 'data' , '\t' ) ;
97
+ queueMicrotask ( ( ) => {
98
+ assert . match ( output , / ^ T a b c o m p l e t i o n e r r o r : E r r o r : m e s s a g e / ) ;
99
+ output = '' ;
100
+ } ) ;
101
+ rli . close ( ) ;
102
+ }
You can’t perform that action at this time.
0 commit comments