Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
happens with my
runTest
implementation using JS IR:
Copy code
val testScope = MainScope()
fun runTest(block: suspend CoroutineScope.() -> Unit): dynamic = testScope.promise { block() }
hfhbd
08/16/2021, 9:59 AM
Copy code
import kotlinx.coroutines.*
import kotlin.test.*
import kotlin.time.*
@ExperimentalTime
class TestingRunTest {
@Test
fun a() = runTest {
var a = 1
assertEquals(1, a)
val job = launch {
delay(1.minutes)
a = 42
}
assertEquals(1, a)
job.join()
assertEquals(42, a)
}
}
val testScope = MainScope()
fun runTest(block: suspend CoroutineScope.() -> Unit): dynamic = testScope.promise { block() }
p
Pitel
08/16/2021, 10:46 AM
Copy code
delay(1.minutes)
🤔
Pitel
08/16/2021, 10:47 AM
The JS test has limit of 2 seconds.
h
hfhbd
08/16/2021, 12:13 PM
Yes. This would be my workaround, to keep all tests under 2 seconds 😄 Or do you know some settings to customize the timeout?
It's possible that there's gradle config for the browser side now too, but there wasn't last I looked at it (a year or so ago)
🙏 2
h
hfhbd
08/16/2021, 1:03 PM
Nope, there is no Gradle high level DSL. I tried browserDisconnectTimeout, but I did know karma still use mocha and its timeout under the hood...
Thanks!