@@ -25,7 +25,7 @@ var runToCheck = cli.runToCheck
2525// Test
2626//------------------------------------------------------------------------------
2727
28- describe ( "If no argument," , function ( ) {
28+ describe ( "[CLI Command] If no argument," , function ( ) {
2929 var result = null
3030
3131 before ( function ( ) {
@@ -48,7 +48,7 @@ describe("If no argument,", function() {
4848 } )
4949} )
5050
51- describe ( "If '--help' is given," , function ( ) {
51+ describe ( "[CLI Command] If '--help' is given," , function ( ) {
5252 var result = null
5353
5454 before ( function ( ) {
@@ -70,7 +70,7 @@ describe("If '--help' is given,", function() {
7070 } )
7171} )
7272
73- describe ( "If '-h' is given," , function ( ) {
73+ describe ( "[CLI Command] If '-h' is given," , function ( ) {
7474 var result = null
7575
7676 before ( function ( ) {
@@ -92,7 +92,7 @@ describe("If '-h' is given,", function() {
9292 } )
9393} )
9494
95- describe ( "If '--version' is given," , function ( ) {
95+ describe ( "[CLI Command] If '--version' is given," , function ( ) {
9696 var result = null
9797
9898 before ( function ( ) {
@@ -115,7 +115,7 @@ describe("If '--version' is given,", function() {
115115 } )
116116} )
117117
118- describe ( "Under Node.js v" + version + "," , function ( ) {
118+ describe ( "[CLI Command] Under Node.js v" + version + "," , function ( ) {
119119 var ranges = [
120120 ">=0.10" ,
121121 ">=0.12" ,
@@ -186,6 +186,35 @@ describe("Under Node.js v" + version + ",", function() {
186186 } )
187187 }
188188 } )
189+
190+ describe ( "with no command," , function ( ) {
191+ var result = null
192+
193+ before ( function ( ) {
194+ return run ( [ range ] ) . then ( function ( ret ) {
195+ result = ret
196+ } )
197+ } )
198+
199+ it ( "should not output to stdout" , function ( ) {
200+ assert ( result . stdout === "" )
201+ } )
202+
203+ it ( "should not output to stderr" , function ( ) {
204+ assert ( result . stderr === "" )
205+ } )
206+
207+ if ( semver . satisfies ( version , range ) ) {
208+ it ( "should exit with zero" , function ( ) {
209+ assert ( result . exitCode === 0 )
210+ } )
211+ }
212+ else {
213+ it ( "should exit with one" , function ( ) {
214+ assert ( result . exitCode === 1 )
215+ } )
216+ }
217+ } )
189218 } )
190219 } )
191220} )
0 commit comments