@@ -70,15 +70,15 @@ function exists (t, filepath, msg) {
7070 t . pass ( msg )
7171 return true
7272 } catch ( ex ) {
73- t . fail ( msg , { found : null , wanted : 'exists' , compare : 'fs.stat(' + filepath + ')' } )
73+ t . fail ( msg , { found : null , wanted : 'exists' , compare : 'fs.stat(' + filepath + ')' } )
7474 return false
7575 }
7676}
7777
7878function notExists ( t , filepath , msg ) {
7979 try {
8080 fs . statSync ( filepath )
81- t . fail ( msg , { found : 'exists' , wanted : null , compare : 'fs.stat(' + filepath + ')' } )
81+ t . fail ( msg , { found : 'exists' , wanted : null , compare : 'fs.stat(' + filepath + ')' } )
8282 return true
8383 } catch ( ex ) {
8484 t . pass ( msg )
@@ -87,16 +87,14 @@ function notExists (t, filepath, msg) {
8787}
8888
8989test ( 'tree-style' , function ( t ) {
90- common . npm ( [ 'install' , '--json' , '--loglevel=warn ' ] , { cwd : base } , function ( err , code , stdout , stderr ) {
90+ common . npm ( [ 'install' , '--json' , '--loglevel=info ' ] , { cwd : base } , function ( err , code , stdout , stderr ) {
9191 if ( err ) throw err
9292 t . is ( code , 0 , 'result code' )
9393 var result = JSON . parse ( stdout )
9494 t . is ( result . added . length , 1 , 'only added one module' )
9595 t . is ( result . added [ 0 ] . name , 'modA' , 'modA got installed' )
96- t . is ( result . warnings . length , 1 , 'one warning' )
97- var stderrlines = stderr . trim ( ) . split ( / \n / )
98- t . is ( stderrlines . length , 2 , 'two lines of warnings' )
99- t . match ( stderr , / S K I P P I N G O P T I O N A L D E P E N D E N C Y / , 'expected optional failure warning in stderr' )
96+ t . is ( result . warnings . length , 0 , 'no warnings' )
97+ t . match ( stderr , / S K I P P I N G O P T I O N A L D E P E N D E N C Y / , 'expected optional failure info in stderr' )
10098 t . match ( stderr , / U n s u p p o r t e d p l a t f o r m / , 'reason for optional failure in stderr' )
10199 t . match ( result . warnings [ 0 ] , / S K I P P I N G O P T I O N A L D E P E N D E N C Y / , 'expected optional failure warning in JSON' )
102100 t . match ( result . warnings [ 0 ] , / U n s u p p o r t e d p l a t f o r m / , 'reason for optional failure in JSON' )
@@ -106,6 +104,14 @@ test('tree-style', function (t) {
106104 } )
107105} )
108106
107+ test ( 'tree-style' , function ( t ) {
108+ common . npm ( [ 'install' , '--loglevel=warn' ] , { cwd : base } , function ( err , code , stdout , stderr ) {
109+ if ( err ) throw err
110+ t . is ( stderr . length , 0 , 'EBADPLATFORM errors for optional deps are excluded from warnings' )
111+ t . done ( )
112+ } )
113+ } )
114+
109115test ( 'cleanup' , function ( t ) {
110116 cleanup ( )
111117 t . end ( )
0 commit comments