heya all I just upgraded to kotest 5.5.1. We use g...
# kotest
m
heya all I just upgraded to kotest 5.5.1. We use gradle and we use something like
./gradlew :module:test --tests "A*"
. While this used to work fine in kotest 5.4.2, with 5.5.1 our CI seems to mark all tests as skipped now.
Copy code
AWSRegionTest > json serialization/deserialization should round trip SKIPPED

AWSRegionTest STANDARD_OUT

    ~~~ AWSRegionTest ~~~
      + json serialization/deserialization should round trip: TestResult=Ignored(reason=json serialization/deserialization should round trip is excluded by test filter(s))
I’m pretty sure that comes from
TestFilterEnabledExtension
I wonder if there’s something that I may have missed or if this is a known regression? that
TestFilterResult.Exclude.reason
value must have been null, which can only be the case if
GradleClassMethodRegexTestFilter.filter
method went to the else branch
s
The code for that was tweaked in 5.5.x so it sounds like a regression occured.
m
i see.. I’m trying to debug my way there. intellij is being a bit 🤕. Does the
KOTEST_DEBUG
flag still work? it’s trying to find this now and I can’t change the target dir 😢
Copy code
Caused by: java.io.FileNotFoundException: /home/sam/development/workspace/kotest/kotest/kotest.log (No such file or directory)
s
yeah the flag should work, if you're in kotest itself, what I do is just hard code it to true sometimes
m
right i see what’s going on..
if I do
./gradlew test --tests "A*"
gradle assigned pattern as
\QA\E.*
which translated that to
path = "*"
. This
pathParts.isEmpty()
is false, so it doesn’t assign that to
null
, but rather, the string
"*"
. this function in
private fun GradleClassMethodRegexTestFilter.match(pattern: String, descriptor: Descriptor): Boolean
always return false as this code block goes to the else.
Copy code
when (descriptor) { 
  is Descriptor.TestDescriptor -> when (path) {
    null -> true
    else -> descriptor.path(false).value.startsWith(path)
  }
  // ...
}
this tries to match for tests whose path starts with the string
"*"
- that doesn’t and never exist. hence all tests are skipped. We can match when path ==
"*"
, then we can return true wdyt @sam
s
So gradle is converting A* to include a .
so it's a valid regex? We could apply a regex match, or do what you said.
m
it does seem like a well formed regex.
A*Test
becomes
\QA\E.*\QTest\E
and that this returns true
Copy code
"AccountDetailsTest".matches("""\QA\E.*\QTest\E""".toRegex())
s
Might be a valid approach but either way fine by ne
m
I’ll file an issue and downgrade kotest for now. I don’t think the other approach is correct it’ll probably cause more problems.. as you can see the path now becomes
*Test
which breaks other stuff
if we can pursue the regex approach that will be better
s
Ok
m
I’ve opened https://github.com/kotest/kotest/issues/3250 will try looking at that asap. very sorry i’ve been inundated at work that i haven’t been helping out kotest for a while 😢