Scala test fails with "Process 'Gradle Test Executor 33' finished with non-zero exit value 1"

Hey friends,

I’m trying to write a simple ScalaTest test that expects an exception, but somehow I think I’m misconfigured. The test executor output (from ./gradlew test --info) looks like the exception is thrown as expected but the test runner doesn’t handle it gracefully.

My test:

test("bogus month") {
   try {
     def long = new CliOpts( List("--year", "2019", "--month", "14", "--day", "10", "--hour", "2") )
     long.month()
   } catch {
     case ex: Throwable =>
       ValidationFailure("Invalid month") should equal (ex)
   }
   assert(false, "should have caught ValidationFailure")
 }

The test output:

Successfully started process 'Gradle Test Executor 33'

observatorium.reaper.CliSuite > bogus month STANDARD_ERROR
   [scallop] Error: Invalid month

observatorium.reaper.CliSuite > bogus month SKIPPED
:test (Thread[Execution worker for ':',5,main]) completed. Took 1.68 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':test'.
> Process 'Gradle Test Executor 33' finished with non-zero exit value 1
 This problem might be caused by incorrect test process configuration.
 Please refer to the test execution section in the User Manual at https://docs.gradle.org/5.4/userguide/java_testing.html#sec:test_execution

Any thoughts?

Thanks!