Just added `kotest-extensions-spring:1.0.1` to my ...
# kotest
r
Just added
kotest-extensions-spring:1.0.1
to my maven project (using surefire to run
kotest-framework-api-jvm:4.6.3
) and with no code changes it stopped finding any of my existing specs. No errors logged, it just silently stops working.
Using
KOTEST_DEBUG=true
as an env var the end of the maven run looks like this:
Copy code
Discovery: Loading specified classes...
Discovery: Loading of selected classes completed in 0ms
After filters there are 3 spec classes
JUnit ExecutionRequest[org.junit.platform.engine.ExecutionRequest] [configurationParameters=LauncherConfigurationParameters [lookups = [systemProperties [...], propertiesFile []]]; rootTestDescriptor=KotestEngineDescriptor: [engine:kotest]]
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  23.442 s
[INFO] Finished at: 2021-11-24T16:32:34Z
[INFO] ------------------------------------------------------------------------
s
you literally just changed the pom ?
r
Yes
Running in IntelliJ via the plugin IntelliJ reports
Test framework quit unexpectedly
, but again no further information.
s
It adds a ConstructorExtension which is automatically used to construct classes
I guess if that had some kind of error
I can see why this is failing on 4.6.3 and fix that as 4.6.4 but it will come after thanks giving
r
OK, thanks - is there an earlier version of kotest and/or the extension you’d expect to work?
s
that extension is used quite heavily, most of any extensions
so you probably have some class lurking about that it can't handle, and kotest isn't catching the exception properly is my guess
are you upgrading to kotlin 1.6 at all ?
r
No, on 1.5.31 at the moment
s
ok so you can't use kotest 5
r
I’ll try debugging in
SpringAutowireConstructorExtension
and see if I can work out where the issue us.
s
ok, in the meantime I'll add a test that deliberately fails a constructor extension to make sure the error is correctly reported
I need to go offline in an hour to drive to IA for thanksgiving, but I can investigate until then
r
I’m not paying you, don’t stress it! If I can work it out I’ll raise a PR.
😂 1
s
what can I say, I take my work and non-work seriously haha
👍 1
Ok 5.0 does the right thing, and reports exceptions
r
I understand why the error isn’t being reported -
KoTestEngine.execute
does
Try { submitAll(plan) }
, but
fun submitAll(plan: TestPlan) = Try { ... }
, so you get a nested
Try<Try<>>
where the top one is a
Success
but the nested one is a
Failure
, so the error reporting
fold
doesn’t get triggered.
s
Ah
That's 4.6 specific
If you wanna raise a pr we can deploy
r
I’ll have a go.
The problem it’s failing to report though is really bizarre -
java.lang.NoSuchMethodError: 'void io.kotest.mpp.LoggerKt.log(java.lang.String)'
But I can see that method! It’s on the classpath! And anyway, why would
kotest-extensions-spring
being on the classpath make it happen?!
s
Hmm that's a multiplatform thing
Maybe spring uses it
And maven gets confused
r
Yup,
kotest-extensions-spring
depends on
io.kotest:kotest-framework-engine-jvm:4.4.3
.
That’ll be it.
s
Ahh
We can bump that and deploy 1 0.2
I'll do that in a minute
r
Is there a kotest bom I can use to try and prevent accidental dependency reversion?
s
Yep
r
Awesome, that’ll fix it. Thanks for your help.
s
No thank you I didn't do anything lol
Ok just checked the spring extension and it doesn't use log at all, so yeah it's just the version getting changed by bringing it in. Nice find.
r
Unfortunately the bom doesn’t declare the
kotest-*-jvm
artifacts - joys of being on Maven not Gradle.
s
You could just add that to your build explicitly
r
Yup, that’s what I’m doing