munit-cats-effect-2


License

License

GroupId

GroupId

org.typelevel
ArtifactId

ArtifactId

munit-cats-effect-2_0.27
Last Version

Last Version

0.9.0
Release Date

Release Date

Type

Type

jar
Description

Description

munit-cats-effect-2
munit-cats-effect-2
Project URL

Project URL

https://github.com/typelevel/munit-cats-effect
Project Organization

Project Organization

Typelevel
Source Code Management

Source Code Management

https://github.com/typelevel/munit-cats-effect

Download munit-cats-effect-2_0.27

How to add to project

<!-- https://jarcasting.com/artifacts/org.typelevel/munit-cats-effect-2_0.27/ -->
<dependency>
    <groupId>org.typelevel</groupId>
    <artifactId>munit-cats-effect-2_0.27</artifactId>
    <version>0.9.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.typelevel/munit-cats-effect-2_0.27/
implementation 'org.typelevel:munit-cats-effect-2_0.27:0.9.0'
// https://jarcasting.com/artifacts/org.typelevel/munit-cats-effect-2_0.27/
implementation ("org.typelevel:munit-cats-effect-2_0.27:0.9.0")
'org.typelevel:munit-cats-effect-2_0.27:jar:0.9.0'
<dependency org="org.typelevel" name="munit-cats-effect-2_0.27" rev="0.9.0">
  <artifact name="munit-cats-effect-2_0.27" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.typelevel', module='munit-cats-effect-2_0.27', version='0.9.0')
)
libraryDependencies += "org.typelevel" % "munit-cats-effect-2_0.27" % "0.9.0"
[org.typelevel/munit-cats-effect-2_0.27 "0.9.0"]

Dependencies

compile (3)

Group / Artifact Type Version
ch.epfl.lamp : dotty-library_0.27 jar 0.27.0-RC1
org.scalameta : munit_0.27 jar 0.7.16
org.typelevel : cats-effect_0.27 jar 2.3.0-M1

Project Modules

There are no modules declared in this project.

munit-cats-effect

Integration library for MUnit and cats-effect.

Binaries

Cats Effect 2 integration is provided via:

libraryDependencies += "org.typelevel" %%% "munit-cats-effect-2" % "0.7.0" % "test"

Cats Effect 3 integration is provided via:

libraryDependencies += "org.typelevel" %%% "munit-cats-effect-3" % "0.7.0" % "test"

Builds are available for Scala 2.12, 2.13, and 3 for both the JVM and Scala.js.

Getting Started

The munit.CatsEffectSuite trait provides the ability to write tests that return IO and SyncIO values without needing to call any unsafe methods (e.g. unsafeRunSync()).

import cats.effect.{IO, SyncIO}
import munit.CatsEffectSuite

class ExampleSuite extends CatsEffectSuite {

  test("tests can return IO[Unit] with assertions expressed via a map") {
    IO(42).map(it => assertEquals(it, 42))
  }

  test("alternatively, asertions can be written via assertIO") {
    assertIO(IO(42), 42)
  }

  test("or via assertEquals syntax") {
    IO(42).assertEquals(42)
  }

  test("SyncIO works too") {
    SyncIO(42).assertEquals(42)
  }

  import cats.effect.std.Dispatcher

  val dispatcher = ResourceFixture(Dispatcher[IO])

  dispatcher.test("resources can be lifted to munit fixtures") { dsp =>
    dsp.unsafeRunAndForget(IO(42))
  }
}

There are more assertion functions like interceptIO and interceptMessageIO as well as syntax versions intercept and interceptMessage. See the CatsEffectAssertions trait for full details.

org.typelevel

typelevel.scala

Let the Scala compiler work for you.

Versions

Version
0.9.0
0.8.0
0.7.0
0.6.0
0.4-28888c3
0.4-589f79f
0.4-39f68f4
0.4-20c1247
0.4-17-84df211
0.4-16d07be
0.4-9a37382
0.4-7cb3c66
0.4-7c27219
0.4-6e6a4bb
0.4-5f8036d
0.4-f2cd1be
0.4-e794916
0.4-e42dd8d
0.4-deeff2d
0.4-0d61d26
0.4-caee938
0.4-c996a5a
0.4-afbc3fe