Live
The Live
trait provides access to the "live" environment from within the
test environment for effects such as printing test results to the console
or timing out tests where it is necessary to access the real environment.
The easiest way to access the "live" environment is to use the live
method with an effect that would otherwise access the test environment.
import zio.clock
import zio.test.environment._
val realTime = live(clock.nanoTime)
The withLive
method can be used to apply a transformation to an effect
with the live environment while ensuring that the effect itself still runs
with the test environment, for example to time out a test. Both of these
methods are re-exported in the environment
package for easy availability.
Type members
Classlikes
Value members
Concrete methods
Constructs a new Live
service that implements the Live
interface.
This typically should not be necessary as TestEnvironment
provides
access to live versions of all the standard ZIO environment types but
could be useful if you are mixing in interfaces to create your own
environment type.
Constructs a new Live
service that implements the Live
interface.
This typically should not be necessary as TestEnvironment
provides
access to live versions of all the standard ZIO environment types but
could be useful if you are mixing in interfaces to create your own
environment type.