I am writing unit tests for my Kotlin client-side javascript code. The client code needs the support of a server which is also written in Kotlin in the same multiplatform Kotlin project. How can I start the server automatically when the unit tests start?
e
ephemient
11/02/2021, 2:26 AM
a. that doesn't sound appropriate for a unit test
b. in general, can be done by defining your own BuildService which can be added to the existing tasks with Task.usesService() or wired into new tasks automatically
v
Vampire
11/02/2021, 8:38 AM
Afair
usesService
is only necessary when you want to restrict concurrent usage of the service to a certain amount, so that Gale knows which tasks use which service. If the concurrent usage of the service is not limited, you can just use it.
Besides that it indeed does not sound appropriate for a unit test, and I'm not sure whether a build service can run the server code within the same project.