kotest icon indicating copy to clipboard operation
kotest copied to clipboard

6.0 Changes Discussion (Including breaking changes)

Open sksamuel opened this issue 1 year ago • 20 comments

Thread to contain some ideas for what we should change / add to 6.0

Breaking

Not Breaking

sksamuel avatar Mar 10 '24 03:03 sksamuel

  • Consider making use of kotlin-power-assert which will become part of the standard compiler plugin set (KT-63607).

OliverO2 avatar Mar 10 '24 13:03 OliverO2

  • Consider making use of kotlin-power-assert which will become part of the standard compiler plugin set (KT-63607).

Should we ask them to consider supporting other types of function names, so we could make it work with shouldBe ?

sksamuel avatar Mar 10 '24 18:03 sksamuel

Seems like functionality like this is already there: https://github.com/bnorm/kotlin-power-assert

The Gradle plugin allows configuring the functions which should be transformed with a list of fully-qualified function names.

// Kotlin DSL
configure<com.bnorm.power.PowerAssertGradleExtension> {
  functions = listOf("kotlin.assert", "kotlin.test.assertTrue")
}

OliverO2 avatar Mar 10 '24 20:03 OliverO2

Seems like functionality like this is already there: https://github.com/bnorm/kotlin-power-assert

The Gradle plugin allows configuring the functions which should be transformed with a list of fully-qualified function names.

// Kotlin DSL
configure<com.bnorm.power.PowerAssertGradleExtension> {
  functions = listOf("kotlin.assert", "kotlin.test.assertTrue")
}

I wounder if it will work for infix though?

sksamuel avatar Mar 10 '24 21:03 sksamuel

I don't currently have an idea of what might work, but things will surely become clearer with some experimentation. It probably makes sense to do this early up and then provide some feedback to Brian for consideration.

OliverO2 avatar Mar 10 '24 21:03 OliverO2

I don't currently have an idea of what might work, but things will surely become clearer with some experimentation. It probably makes sense to do this early up and then provide some feedback to Brian for consideration.

Yep agreed.

sksamuel avatar Mar 10 '24 21:03 sksamuel

  • Consider switching default TestIsolationMode to InstancePerTest to better align with the 'expected' default behavior from JUnit

  • Consider/Check possibility/ignore gradle limitations on TEST_AND_CONTAINER If you remember the problem, we wanted to merge FreeSpec into StringSpec and some other similar things. The problem was that Gradle doesn't support TEST_AND_CONTAINER correctly, and for such reason we couldn't use that kind of test. We can reconsider if we want to support gradle mainly/add our own plugin or something similar to detach even more from Gradle

LeoColman avatar Mar 11 '24 13:03 LeoColman

  • Consider/Check possibility/ignore gradle limitations on TEST_AND_CONTAINER If you remember the problem, we wanted to merge FreeSpec into StringSpec and some other similar things. The problem was that Gradle doesn't support TEST_AND_CONTAINER correctly, and for such reason we couldn't use that kind of test. We can reconsider if we want to support gradle mainly/add our own plugin or something similar to detach even more from Gradle

Gradle still doesn't correctly support TEST_AND_CONTAINER. That ticket has been open since 2017 so unlikely to be fixed.

sksamuel avatar Mar 11 '24 14:03 sksamuel

I re-opened the discussions feature and added a category for 6.0.. https://github.com/kotest/kotest/discussions/categories/6-0-changes

I think the discussions will be easier to follow/participate in if it's 1 thread per change.. what do you think? We can close discussions down again if there's no consensus in favor of this.

Kantis avatar Mar 13 '24 22:03 Kantis

+1 for "Update the kotest plugin to run individual tests in native and js". Would be helpful for both intellij and gradle plugins to work nicer with multiplatform projects

stantronic avatar Mar 16 '24 17:03 stantronic

What about unifying the base package?

Like, from "com.sksamuel.kotest.listeners.spec.singleinstance" to "io.kotest.listeners.spec.singleinstance".

I looked at the code and only the package of the test code is not unified, so this change will not be a breaking change.

kshired avatar Mar 18 '24 14:03 kshired

@kshired The reason we keep some tests in com.sksamuel.kotest is usually to test things related to package where we don't want to exclude it. We usually exclude io.kotest.* from anything package-related.

I'm not sure if that's the case for the test you mentioned, but it's very likely to be

LeoColman avatar Mar 18 '24 15:03 LeoColman

Yeah kotest is setup to fold io.kotest stacktraces and things like that, so using my domain for tests is an easy way to avoid that. That should only be used for tests tho.

sksamuel avatar Mar 18 '24 15:03 sksamuel

For breaking changes I think it is right time to upgrade gradle version to support java 17 and 21!

for 6.0 I think this kind of major change is possible!

gradle compatibility matrix

mirageoasis avatar Mar 25 '24 09:03 mirageoasis

For breaking changes I think it is right time to upgrade gradle version to support java 17 and 21!

for 6.0 I think this kind of major change is possible!

gradle compatibility matrix

If we compile with Java8 does it matter what version of gradle we use ?

sksamuel avatar Mar 26 '24 01:03 sksamuel

@mirageoasis @sksamuel I've created Upgrade gradle version to support java 17 and 21 to track your discussion

LeoColman avatar Mar 26 '24 13:03 LeoColman

maybe adding linter would be great to enforce coding styles! considering code base that kotest has applying linter on major version change would be nice!

mirageoasis avatar May 14 '24 10:05 mirageoasis