https://kotlinlang.org logo
m

mgrzechocinski

04/09/2019, 5:26 AM
Hej @sam and @LeoColman, regarding
executionError
which is fixed in
3.3.2
I’d like to ask about
initializationError
, reported by Gradle in some specific scenario. Consider following example:
Copy code
class InitErrorTest : ExpectSpec() {

  init{
    context("This context") {
      throw RuntimeException("should fail")
    }
  }
}
Running this spec within IntelliJ shows that context fails with “Should fail” message. However on Gradle it looks like this:
Copy code
mypackage.InitErrorTest > mypackage.InitErrorTest > initializationError FAILED
    java.lang.RuntimeException at InitErrorTest.kt:10
Is it something on the kotlintest side as well and can be fixed or am I using
context { }
in a wrong way and should nest
expect { }
inside? When nesting though:
Copy code
init{
    context("This context") {
      expect("failure"){
        throw RuntimeException("should fail")
      }
    }
  }
Gradle doesn’t show exception message:
Copy code
mypackage.InitErrorTest > Expect: failure FAILED
    java.lang.RuntimeException at InitErrorTest.kt:11

1 test completed, 1 failed
, however IntelliJ does. Thanks in advance for any hints.