zio
zio copied to clipboard
zio-test: missing suite constructor from ZIO[..,..,Suite[Env, Err]]
I was able to introduce such an implicit in my code, I believe it belongs in zio.test:
implicit def zioSuiteConstructor[R, R1, E <: E2, E1 <: E2, E2] : SuiteConstructor.WithOut[ZIO[R, E, Spec[R1, E1]], R with R1, E2] =
new SuiteConstructor[ZIO[R, E, Spec[R1, E1]]] {
override type OutEnvironment = R with R1
override type OutError = E2
override def apply(z: ZIO[R, E, Spec[R1, E1]])(implicit trace: Trace): Spec[R with R1, E2] = {
val res: Spec[R with R1, E2] = Spec.scoped[R with R1](z.mapError(TestFailure.fail(_)))
res
}
}
I'll push a pr for this unless there's any objection to adding this
Can you explain when you get this message?
I have a shared service used by multiple/all tests in the suite, I want to be able to do something like:
val suiteZ : ZIO[Svc with Env, Err, Suite[Svc with Env, Err] = ZIO.serviceWith[Svc]{svc =>
suite(..){...}
}
and then:
override val spec = suite(...)(suiteZ, ...).provideShared(...)
@eyalfa feel free to open a PR!