All Downloads are FREE. Search and download functionalities are using the official Maven repository.

zio.test.results.ResultPrinterJson.scala Maven / Gradle / Ivy

There is a newer version: 2.1.9
Show newest version
package zio.test.results

import zio.test._
import zio.{ZIO, ZLayer}

private[test] object ResultPrinterJson {
  val live: ZLayer[Any, Nothing, ResultPrinter] =
    ZLayer.make[ResultPrinter](
      ResultSerializer.live,
      ResultFileOps.live,
      ZLayer.fromFunction(
        LiveImpl(_, _)
      )
    )

  private case class LiveImpl(serializer: ResultSerializer, resultFileOps: ResultFileOps) extends ResultPrinter {
    override def print[E](event: ExecutionEvent.Test[E]): ZIO[Any, Nothing, Unit] =
      resultFileOps.write(serializer.render(event), append = true).orDie
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy