Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
djspiewak committed Nov 28, 2021
1 parent fa12a69 commit fd6cc7c
Showing 1 changed file with 6 additions and 40 deletions.
46 changes: 6 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ The Resource is acquired before the tests are run and released afterwards. A mor
libraryDependencies += "org.typelevel" %% "cats-effect-testing-specs2" % "<version>" % Test
```

Published for Scala 3.0.0-RC3, 2.13, 2.12, as well as ScalaJS 1.5.1. Depends on Cats Effect 3.1.0 and specs2 4.11.0.
Published for Scala 3.1+, 2.13, 2.12, as well as ScalaJS 1.7+. Depends on Cats Effect 3.1+ and Specs2 4.13.x. Specs2 5.0 is not yet supported.

Early versions (`0.x.y`) were published under the `com.codecommit` groupId.

Expand All @@ -96,7 +96,7 @@ class MySpec extends AsyncFreeSpec with AsyncIOSpec with Matchers {
libraryDependencies += "org.typelevel" %% "cats-effect-testing-scalatest" % "<version>" % Test
```

Published for Scala 3.0.0-RC3, 2.13, 2.12, as well as ScalaJS 1.5.1. Depends on Cats Effect 3.1.0 and scalatest 3.2.6.
Published for Scala 3.1+, 2.13, 2.12, as well as ScalaJS 1.7.x. Depends on Cats Effect 3.1+ and scalatest 3.2.6.

Early versions (`0.x.y`) were published under the `com.codecommit` groupId.

Expand All @@ -107,9 +107,8 @@ import scala.concurrent.duration._
import utest._
import cats.implicits._
import cats.effect.IO
import cats.effect.testing.utest.{IOTestSuite, DeterministicIOTestSuite}
import cats.effect.testing.utest.IOTestSuite

// IOTestSuite uses real ExecutionContext for async operations
object SimpleSuite extends IOTestSuite {
override val timeout = 1.second // Default timeout is 10 seconds

Expand All @@ -120,26 +119,6 @@ object SimpleSuite extends IOTestSuite {
}
}

// DeterministicIOTestSuite simulates time with TestContext from cats-effect-laws
// package. That allows to simulate long timeouts and have async operations
// without actually slowing down your test suite, but it cannot use operations
// that are hard-wired to do real async calls
object DetSuite extends DeterministicIOTestSuite {
// By default, both types of suite prevents using non-IO return values.
// I recommend separating effectful and pure suites altogether, but
// this can be overriden like so:
override val allowNonIOTests = true
val tests = Tests {
test("Simulated time!") {
IO.sleep(8.hours) >> IO(assert(!"life".isEmpty))
}

test("Non-IO tests") {
assert(true)
}
}
}

```

### Usage
Expand All @@ -148,7 +127,7 @@ object DetSuite extends DeterministicIOTestSuite {
libraryDependencies += "org.typelevel" %% "cats-effect-testing-utest" % "<version>" % Test
```

Published for Scala 3.0.0-RC3, 2.13, 2.12, as well as ScalaJS 1.5.1. Depends on Cats Effect 3.1.0 and µTest 0.7.9.
Published for Scala 3.1+, 2.13, 2.12, as well as ScalaJS 1.7.x. Depends on Cats Effect 3.1+ and µTest 0.7.9.

Early versions (`0.x.y`) were published under the `com.codecommit` groupId.

Expand All @@ -161,28 +140,15 @@ non-IO tests
import scala.concurrent.duration._
import cats.implicits._
import cats.effect.IO
import cats.effect.testing.minitest.{IOTestSuite, DeterministicIOTestSuite}
import cats.effect.testing.minitest.IOTestSuite

// IOTestSuite uses real ExecutionContext for async operations
// (can be overriden by reimplementing makeExecutionContext)
object SimpleSuite extends IOTestSuite {
override val timeout = 1.second // Default timeout is 10 seconds

test("do the thing") {
IO(assert(true))
}
}

// DeterministicIOTestSuite simulates time with TestContext from cats-effect-laws
// package. That allows to simulate long timeouts and have async operations
// without actually slowing down your test suite, but it cannot use operations
// that are hard-wired to do real async calls
object DetSuite extends DeterministicIOTestSuite {
test("Simulated time!") {
IO.sleep(8.hours) >> IO(assert(!"life".isEmpty))
}
}

```

### Usage
Expand All @@ -191,7 +157,7 @@ object DetSuite extends DeterministicIOTestSuite {
libraryDependencies += "org.typelevel" %% "cats-effect-testing-minitest" % "<version>" % Test
```

Published for Scala 3.0.0-RC3, 2.13, 2.12, as well as ScalaJS 1.5.1. Depends on Cats Effect 3.1.0 and minitest 2.9.5.
Published for Scala 3.1+, 2.13, 2.12, as well as ScalaJS 1.7.x. Depends on Cats Effect 3.1+ and minitest 2.9.5.

Early versions (`0.x.y`) were published under the `com.codecommit` groupId.

Expand Down

0 comments on commit fd6cc7c

Please sign in to comment.