File tree Expand file tree Collapse file tree 1 file changed +40
-8
lines changed Expand file tree Collapse file tree 1 file changed +40
-8
lines changed Original file line number Diff line number Diff line change @@ -31,23 +31,23 @@ common.skipIfDumbTerminal();
3131 const width = getStringWidth ( char ) - 1 ;
3232
3333 class FakeInput extends EventEmitter {
34- columns = ( ( width + 1 ) * 10 + ( lineBreak ? 0 : 10 ) ) * 3
34+ columns = ( ( width + 1 ) * 10 + ( lineBreak ? 0 : 10 ) ) * 3
3535
36- write = common . mustCall ( ( data ) => {
37- output += data ;
38- } , 6 )
36+ write = common . mustCall ( ( data ) => {
37+ output += data ;
38+ } , 6 )
3939
40- resume ( ) { }
41- pause ( ) { }
42- end ( ) { }
40+ resume ( ) { }
41+ pause ( ) { }
42+ end ( ) { }
4343 }
4444
4545 const fi = new FakeInput ( ) ;
4646 const rli = new readline . Interface ( {
4747 input : fi ,
4848 output : fi ,
4949 terminal : true ,
50- completer : completer
50+ completer : common . mustCallAtLeast ( completer ) ,
5151 } ) ;
5252
5353 const last = '\r\nFirst group\r\n\r\n' +
@@ -68,3 +68,35 @@ common.skipIfDumbTerminal();
6868 rli . close ( ) ;
6969 } ) ;
7070} ) ;
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