Expose `waitForCompletion` for overriding
armanbilge opened this issue · 1 comments
This is used to support timeouts for tests.
munit/munit/shared/src/main/scala/munit/FunSuite.scala
Lines 49 to 51 in 166698e
The Scala Native implementation doesn't support timeouts (due to limitations of the single-threaded runtime). And actually I suspect the JavaScript one is broken too with the default parasitic execution context.
munit/munit/native/src/main/scala/munit/internal/PlatformCompat.scala
Lines 22 to 28 in 166698e
However, it is possible to implement timeouts for Scala Native when also overriding the ExecutionContext
with a more sophisticated runtime.
For example the QueueExecutorScheduler
in Cats Effect Native supports timeouts. Since we are using the Cats Effect runtime in munit-cats-effect, I would like to be able to support test timeouts there by overriding waitForCompletion
.
Of course we could solve this in userland by adding timeouts to the IO
-transform in munit-cats-effect, but then it wouldn't work for non-IO
-based tests that also happen to be running in a Cats Effect suite.
I decided to solve this in user-land. MUnit timeouts have other caveats, like lack of support for cancellation.