lolhens / munit-tagless-final

Integration library for MUnit and any effect type via cats-effect

Version Matrix

munit-tagless-final

Test Workflow Release Notes Maven Central Apache License 2.0 Scala Steward badge

Integration library for MUnit and any effect type via cats-effect.

This project is based on typelevel/munit-cats-effect.

build.sbt

// use this snippet for cats-effect 2 and the JVM
libraryDependencies += "de.lolhens" %% "munit-tagless-final" % "0.0.1" % Test

// use this snippet for cats-effect 2 and JS, or cross-building
libraryDependencies += "de.lolhens" %%% "munit-tagless-final" % "0.0.1" % Test

// use this snippet for cats-effect 3 and the JVM
libraryDependencies += "de.lolhens" %% "munit-tagless-final" % "0.2.0" % Test

// use this snippet for cats-effect 3 and JS, or cross-building
libraryDependencies += "de.lolhens" %%% "munit-tagless-final" % "0.2.0" % Test

Example

Cats Effect 2

import cats.effect.IO

import scala.concurrent.Future

abstract class CatsEffectSuite extends TaglessFinalSuite[IO] {
  override protected def toFuture[A](f: IO[A]): Future[A] = f.unsafeToFuture()
}

Cats Effect 3

import cats.effect.{IO, unsafe}

import scala.concurrent.Future

abstract class CatsEffectSuite extends TaglessFinalSuite[IO] {
  override protected def toFuture[A](f: IO[A]): Future[A] = f.unsafeToFuture()(unsafe.IORuntime.global)
}

Monix

import monix.eval.Task
import monix.execution.Scheduler

import scala.concurrent.Future

abstract class TaskSuite extends munit.TaglessFinalSuite[Task] {
  override protected def toFuture[A](f: Task[A]): Future[A] = f.runToFuture(Scheduler.global)
}

License

This project uses the Apache 2.0 License. See the file called LICENSE.