@@ -6,15 +6,26 @@ const manifest = require("../../package.json");
66
77describe ( "bump" , ( ) => {
88
9- it . skip ( "should run without any arguments" , ( ) => {
9+ it ( "should run without any arguments" , function ( ) {
10+ // Create a dummy package.json, otherwise an error will occur
1011 files . create ( "package.json" , { version : "1.0.0" } ) ;
1112
12- let bump = chaiExec ( "" , { timeout : 1000 } ) ;
13-
14- expect ( bump . signal ) . to . equal ( "SIGKILL" ) ;
15-
13+ // Run the CLI without any arguments.
14+ // It will prompt the user and wait forever, so add a timeout.
15+ this . timeout ( Math . max ( 5000 , this . timeout ( ) ) ) ;
16+ let bump = chaiExec ( "" , { timeout : 2500 } ) ;
17+
18+ if ( bump . status ) {
19+ // The CLI threw an error, because there is no STDIN
20+ expect ( bump ) . to . have . exitCode ( 1 ) ;
21+ }
22+ else {
23+ expect ( bump . signal ) . to . be . oneOf ( [ "SIGINT" , "SIGTERM" ] ) ;
24+ }
25+
26+ // Regardless of how it exited, it should have prompted for input
27+ expect ( bump . stdout ) . to . contain ( "The current version is 1.0.0\nHow would you like to bump it? (Use arrow keys)" ) ;
1628 expect ( bump ) . to . have . stderr ( "" ) ;
17- expect ( bump . stdout ) . to . contain ( "PROMPT TEXT" ) ;
1829 } ) ;
1930
2031 it ( "should error if an invalid argument is used" , ( ) => {
0 commit comments