@@ -66,6 +66,59 @@ t.test('basic arg parsing stuff', t => {
6666 ] )
6767 } )
6868
69+ t . test ( 'verbose' , async t => {
70+ t . equal ( await bin ( '-v' , 'foo' ) , 0 )
71+ t . equal ( await bin ( '--verbose' , 'foo' ) , 0 )
72+ t . equal ( await bin ( '-v' , '-V' , '--verbose' , 'foo' ) , 0 )
73+ t . same ( LOGS , [ ] )
74+ t . same ( ERRS , [ ] )
75+ for ( const c of CALLS ) {
76+ t . equal ( c [ 0 ] , 'rimraf' )
77+ t . same ( c [ 1 ] , [ 'foo' ] )
78+ t . type ( c [ 2 ] . filter , 'function' )
79+ t . equal ( c [ 2 ] . filter ( 'x' ) , true )
80+ }
81+ } )
82+
83+ t . test ( 'verbose' , async t => {
84+ t . equal ( await bin ( '-v' , 'foo' ) , 0 )
85+ t . equal ( await bin ( '--verbose' , 'foo' ) , 0 )
86+ t . equal ( await bin ( '-v' , '-V' , '--verbose' , 'foo' ) , 0 )
87+ t . same ( LOGS , [ ] )
88+ t . same ( ERRS , [ ] )
89+ const { log } = console
90+ t . teardown ( ( ) => { console . log = log } )
91+ const logs = [ ]
92+ console . log = ( s ) => logs . push ( s )
93+ for ( const c of CALLS ) {
94+ t . equal ( c [ 0 ] , 'rimraf' )
95+ t . same ( c [ 1 ] , [ 'foo' ] )
96+ t . type ( c [ 2 ] . filter , 'function' )
97+ t . equal ( c [ 2 ] . filter ( 'x' ) , true )
98+ t . same ( logs , [ 'x' ] )
99+ logs . length = 0
100+ }
101+ } )
102+
103+ t . test ( 'silent' , async t => {
104+ t . equal ( await bin ( '-V' , 'foo' ) , 0 )
105+ t . equal ( await bin ( '--no-verbose' , 'foo' ) , 0 )
106+ t . equal ( await bin ( '-V' , '-v' , '--no-verbose' , 'foo' ) , 0 )
107+ t . same ( LOGS , [ ] )
108+ t . same ( ERRS , [ ] )
109+ const { log } = console
110+ t . teardown ( ( ) => { console . log = log } )
111+ const logs = [ ]
112+ console . log = ( s ) => logs . push ( s )
113+ for ( const c of CALLS ) {
114+ t . equal ( c [ 0 ] , 'rimraf' )
115+ t . same ( c [ 1 ] , [ 'foo' ] )
116+ t . type ( c [ 2 ] . filter , 'function' )
117+ t . equal ( c [ 2 ] . filter ( 'x' ) , true )
118+ t . same ( logs , [ ] )
119+ }
120+ } )
121+
69122 t . test ( 'glob true' , async t => {
70123 t . equal ( await bin ( '-g' , 'foo' ) , 0 )
71124 t . equal ( await bin ( '--glob' , 'foo' ) , 0 )
0 commit comments