Hey everyone :wave: , Is there any way in Kotest i...
# kotest
s
Hey everyone 👋 , Is there any way in Kotest increase the time-out for promises?
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
d
There seems to be two timeouts in Project/Spec configs:
Copy code
/**
    * A global timeout that is applied to all tests if not null.
    * Tests which define their own timeout will override this.
    */
   open val timeout: Duration? = null

   /**
    * A global invocation timeout that is applied to all tests if not null.
    * Tests which define their own timeout will override this.
    * The value here is in millis
    */
   open val invocationTimeout: Long? = null
did you try those?
s
Hey @dave08, Yes, this seems to be a different time-out than the one set here. I have that one on the default which is 10s, but here I am failing with an error from the Promise. This seems to come from the JS runtime, rather than the Kotest runtime but I'm not sure.
Funny that the default for the first seems to be 2000, but your problem could be something else...
s
s
Interesting. Seems like yeah the 2000 is coming from karma
s
@sam I found a workaround by manually configuring karma through Gradle. It is indeed coming from Karma, and I'm not sure how the timeout is related to the tests. The timeout does not seem to correctly correspond to the tests though, it seems like not every test is running in a Karma Promise. Is that correct? The tests are way faster than the 2000ms per test.
s
Only the inner most tests run as a promise, that's how karma works
s
So it's creating a promise for every
String#invoke
for
StringSpec
for example?
s
yes, but the test shouldn't take 2000 if your tests finishes sooner
s
Right, then I'm not sure how I'm running into this in some cases. I just saw a failure whilst the suite takes 7ms after updating the Gradle config.
s
Hmm, you could try switching the js runner to use something other than karma
s
Kotlin JS supports
Copy code
Jasmine
too
it's great that you got this to work. I'm currently working on a compiler plugin for IR that will make this work better in kotest 5
s
😍
s
and will support native
s
Awesome, I'm really looking forward to that!
s
shouldn't take much longer, I'm blocked atm on the compiler plugin as the docs are still a bit lacking
s
Arrow Core should be ready for native, if you need a tester I'd be happy to help.
s
should get there soon though 🙂
I'm hoping Kotest 5 by end of month
😍 1
s
That's perfect, by then I hope to have 1.0.0-M1 with JS out too and I can start using Kotest for native 🥳
s
I haven't played too much with the native stuff yet, but for JS I'm detecting spec classes and creating code that runs them. In theory, the native should work exactly the same way. In other words, the compiler plugin effectively creates
SpecExecutor.execute(ThisClass())
and put's that inside the main entry point (for each spec)