kotest / kotest-intellij-plugin

The official Kotest plugin for Intellij and Android Studio
Apache License 2.0
179 stars 25 forks source link

Normalize multiline string spec test names. #252

Closed canatella closed 12 months ago

canatella commented 1 year ago

Currently, when defining a test in a StringSpec with multiple lines, it cannot be run by clicking the icon next to it. For example:

class MyTests : StringSpec({

    """This test name is spread
        over multiple lines withe indentation.
    """ {
        true shouldBe true
    }
})

The output when hitting the run single test icon:

... io.kotest.engine.launcher.MainKt --spec MyTests --testpath This test name is spread
        over multiple lines withe indentation.
     --reporter teamcity
Testing started at 10:51 ...

Process finished with exit code 0

This test name is spread over multiple lines withe indentation. is excluded by test filter(s): Excluded by test path filter: 'This test name is spread
        over multiple lines withe indentation.
    '

Replacing all consecutive white space in the name by a single space fixes the issue.

... io.kotest.engine.launcher.MainKt --spec com.bloomlife.lib.athena.MyTests --testpath This test name is spread over multiple lines withe indentation. --reporter teamcity Testing started at 10:54 ...

Process finished with exit code 0

Kantis commented 1 year ago

I believe this would solve #255 as well.. need to verify it.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

canatella commented 1 year ago

Any news ?

canatella commented 1 year ago

That's not really nice. I take the time to submit a PR that fixes an issue. Nobody reacts, which I can understand, we are all busy, but then it's closed automatically. Come on...

sksamuel commented 1 year ago

Just the stale bot. Reopened.

sksamuel commented 1 year ago

@canatella if you build this locally and install it, can you confirm you can then run multi-line tests from intellij?

I think we need to check as well that if you have a test with double spaces deliberately, it still works, because you're matching on \s+ rather than \n say.

canatella commented 1 year ago

@sksamuel I'm trying to add a unit test, but it seems I can't run them. What is the proper way to run the tests ? I'm using

PRODUCT_NAME=IC-233 ./gradlew check -Dorg.gradle.configureondemand=true -Dorg.gradle.parallel=false -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8" 

But I have

java.lang.RuntimeException: java.util.concurrent.ExecutionException: com.intellij.testFramework.TestLoggerFactory$TestLoggerAssertionError: Index data initialization failed
sksamuel commented 1 year ago

That seems to be an issue with any of the 23x builds. I test locally against 22x.