Kotest: Compilation error when using kotest-assertions-core-jvm without kotest runner dependency

Created on 30 Apr 2020  路  8Comments  路  Source: kotest/kotest

According to the docs, to use assertions library it should be enough to add one dependency io.kotest:kotest-assertions-core-jvm:<version>. Unfortunately this doesn't work, some matchers cannot be resolved and compilation fails. Here's a minimal project that reproduces the problem: https://github.com/akowal/kotest-deps-issue/

bug

Most helpful comment

I think its because in 4.0.x the dependency is implementation(project(":kotest-assertions"))
In master its api.
I'll release 4.0.6 with this fix and some others.

All 8 comments

Another observation, running test using intellij test runner works fine however with gradle it fails to resolve the import statement.

I don't know why it doesn't work because

         // this is api because we want to expose `shouldBe` etc
            api(project(Projects.AssertionsShared))

I'm getting the same problem lol

When I use the latest snapshot, this problem doesn't exist anymore. Here is a copy of @akowal's repository that uses the latest snapshot: https://github.com/TheNumberOne/kotest-deps-issue

I was also having a same issue, and following @TheNumberOne's suggestion to use the latest snapshot (kotest-assertions-core-jvm:4.1.0.291-SNAPSHOT) solved the problem for now.

I've also just run into this issue, exact same configuration as OP and moving to snapshot as per @TheNumberOne has fixed it.

I think its because in 4.0.x the dependency is implementation(project(":kotest-assertions"))
In master its api.
I'll release 4.0.6 with this fix and some others.

4.0.6 has been released which fixes this.

Was this page helpful?
0 / 5 - 0 ratings