pureharm / pureharm-testkit   0.4.0

Apache License 2.0 GitHub

testkit for pureharm, based on munit + cats-effect

Scala versions: 3.x 2.13
Scala.js versions: 1.x


See changelog.

Scala versions

  • 2.13, JS + JVM
  • 3.0.1, JS + JVM



⚠️ only for sbt version lower than 1.5.0

If you are on sbt versions lower than 1.5.0, then follow the munit setup to add the appropriate test framework to your build.

testFrameworks += new TestFramework("munit.Framework")

for sbt versions greater or equal to 1.5.0, and after the above setup

Create your own "testkit" package. And use that everywhere.

package myapp

import busymachines.pureharm.testkit

package object test extends testkit.PureharmTestkitAliases

//-------- EOF --------

package myapp.test

 * Add any custom assertions, flavors, styles, opiniated decisions
 * here, and continue using this.
abstract class MyAppTest extends testkit.PureharmTestkit

//-------- EOF --------

package myapp.somemodule

import myapp.test._

final class MyTest extends MyAppTest {
  test("no resource")(IO.unit)

  private val myResource =
    ResourceFixture((to: TestOptions) => Resource.eval(testLogger.info(s"Making: $to") >> Timer[IO].sleep(10.millis)))

  myResource.test(TestOptions("with resource").tag(Slow))((_: Unit) => testLogger.info("Executing test w/ resource"))

Still under construction. See release notes and tests for examples.

Copyright and License

All code is available to you under the Apache 2.0 license, available at http://www.apache.org/licenses/LICENSE-2.0 and also in the LICENSE file.