Improve ServerSpec feedback

In some cases if sbt is broken in the right way (for example if the
process dies), the ServerSpec will spam the console by printing empty
lines. This commit prevents it from printing empty lines and also stops
waiting for a server response if the process has died.
This commit is contained in:
Ethan Atkins 2019-11-23 16:37:46 -08:00
parent 0d1d8a790c
commit 2049ce3632
1 changed files with 2 additions and 2 deletions

View File

@ -166,7 +166,7 @@ object TestServer {
val init =
Try {
testServer.waitForString(30.seconds) { s =>
println(s)
if (s.nonEmpty) println(s)
s contains """"message":"Done""""
}
}
@ -292,7 +292,7 @@ case class TestServer(baseDirectory: File) {
val deadline = duration.fromNow
@tailrec
def impl(): Boolean = {
if (deadline.isOverdue) false
if (deadline.isOverdue || !process.isAlive) false
else readFrame.fold(false)(f) || impl
}
impl()