Hi all, I'm having some issues running tests with coroutines in KotlinJS. When I set it up like in the below screenshot, the test runs immediately and does not wait for the launch coroutine to finish. Is there a way I can setup the test so it will wait on launch to finish?
a
andylamax
04/15/2024, 3:41 PM
use
runTest
instead of
GlobalScope.launch
andylamax
04/15/2024, 3:41 PM
Make sure you have
kotlinx-coroutines-test
g
gbaldeck
04/15/2024, 3:54 PM
Thanks! Worked perfectly
e
Edoardo Luppi
04/16/2024, 2:25 PM
Unrelated, but which mocking lib are you using?
g
gbaldeck
04/16/2024, 2:38 PM
Its my own implementation made to match jest since it is difficult to get jest to work with karma.