I am trying to test periodic caller: ``` @JsName("...
# coroutines
m
I am trying to test periodic caller:
Copy code
@JsName("numberOfCallsInTimeTest")
fun `Periodic caller for 50ms is called around 20 times in 1 second`() {
    val caller = PeriodicCaller.PeriodicCallerImpl()
    var count = 0
    runBlocking {
        val job = caller.start(50) { count++ }
        delay(1000)
        job.cancel()
    }
    assertTrue(count in 17..23)
}
This test works well on JVM, but on JS it throws
Copy code
stack: IllegalStateException: JS thread cannot be blocked, runBlocking { ... } cannot be waiting for its completion with timeout