@ -17,6 +17,7 @@
package org.springframework.boot.cli.command.test ;
package org.springframework.boot.cli.command.test ;
import joptsimple.OptionSet ;
import joptsimple.OptionSet ;
import joptsimple.OptionSpec ;
import org.springframework.boot.cli.command.Command ;
import org.springframework.boot.cli.command.Command ;
import org.springframework.boot.cli.command.OptionParsingCommand ;
import org.springframework.boot.cli.command.OptionParsingCommand ;
@ -45,6 +46,12 @@ public class TestCommand extends OptionParsingCommand {
private TestRunner runner ;
private TestRunner runner ;
@Override
protected void doOptions ( ) {
option ( "nohup" ,
"Flag to indicate that the JVM should not exit when tests are finished" ) ;
}
@Override
@Override
protected void run ( OptionSet options ) throws Exception {
protected void run ( OptionSet options ) throws Exception {
SourceOptions sourceOptions = new SourceOptions ( options ) ;
SourceOptions sourceOptions = new SourceOptions ( options ) ;
@ -53,6 +60,9 @@ public class TestCommand extends OptionParsingCommand {
this . runner = new TestRunner ( configuration , sourceOptions . getSourcesArray ( ) ,
this . runner = new TestRunner ( configuration , sourceOptions . getSourcesArray ( ) ,
sourceOptions . getArgsArray ( ) ) ;
sourceOptions . getArgsArray ( ) ) ;
this . runner . compileAndRunTests ( ) ;
this . runner . compileAndRunTests ( ) ;
if ( ! options . has ( "nohup" ) ) {
System . exit ( 0 ) ; // TODO: non-zero if test fails?
}
}
}
/ * *
/ * *