Sabeeh
05/14/2024, 7:40 PMrunBlockingTest
or runTest
for running suspend tests in a Kotlin/Wasm (wasmJs) target?
For js I'm doing following and its working fine:
in commonTest:
expect fun runTest(block: suspend () -> Unit)
in jsTest:
actual fun runTest(block: suspend () -> Unit): dynamic = GlobalScope.promise { block() }
This is not working for wasmJs because dynamic is not supported in wasmJs.Robert Jaros
05/14/2024, 8:02 PMPromise
from the test function (and by using coroutines asPromise() function you can test suspending code).Tomislav Mladenov
05/14/2024, 8:04 PMSabeeh
05/14/2024, 8:54 PMSabeeh
05/14/2024, 8:58 PMrunTest
to Any
that may workRobert Jaros
05/14/2024, 9:27 PMJsAny