{"id":20059567,"url":"https://github.com/monix/monix-testing","last_synced_at":"2025-05-05T15:31:47.632Z","repository":{"id":57735897,"uuid":"415529106","full_name":"monix/monix-testing","owner":"monix","description":"Integration between Monix and test frameworks.","archived":false,"fork":false,"pushed_at":"2022-10-30T15:16:54.000Z","size":51,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-03-26T14:28:55.912Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/monix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-10T08:35:25.000Z","updated_at":"2024-03-26T14:28:55.913Z","dependencies_parsed_at":"2022-08-24T14:57:19.238Z","dependency_job_id":null,"html_url":"https://github.com/monix/monix-testing","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monix%2Fmonix-testing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monix%2Fmonix-testing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monix%2Fmonix-testing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monix%2Fmonix-testing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monix","download_url":"https://codeload.github.com/monix/monix-testing/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224452805,"owners_count":17313668,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T13:08:23.790Z","updated_at":"2024-11-13T13:08:24.546Z","avatar_url":"https://github.com/monix.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Monix Testing\n\nLibrary aimed to provide support to integrate Monix Task with different testing frameworks.\n\n## Releases\n\nAvailable for **Scala 2.12** and **2.13** and **3**.\n## Credits\n\nThis project is ported from [typelevel/cats-effect-testing](https://github.com/typelevel/cats-effect-testing), with the difference that this library provides support for `Task` instead of `IO`. So credits to their authors and maintainers🙏\n\nMainly with the purpose of supporting task-testing on monix series 3.x, \nsince once monix is compatible with cats effect `3.0` this project will most likely not be longer useful, \nsince then we will be able to use `cats-effect-testing` 1.x \nwhich is implemented with _Tagless Final_, thus compatible with\neither `IO` and `Task`.\n\n## Scalatest\n\nAdd the following dependency to your *build.sbt*:\n\n```sbt\n\"io.monix\" %% \"monix-testing-scalatest\" % \"0.3.0\"\n```\n\n   It provides a set of implicit conversions to convert [[Task]] to [[Future]], so the\n   user does not need to do it for every test.\n  \n  ```scala\n   import monix.eval.Task\n   import monix.execution.Scheduler\n   import monix.testing.scalatest.MonixTaskTest\n   import org.scalatest.funsuite.AsyncFunSuite\n   import org.scalatest.matchers.should.Matchers\n  \n   class DummySpec extends AsyncFunSuite with MonixTaskTest with Matchers {\n  \n       override implicit def scheduler: Scheduler = Scheduler.io(\"monix-task-support-spec\")\n  \n       test(\"AsyncTestSuite with Task support\") {\n           for {\n               r1 \u003c- Task(2)\n               r2 \u003c- Task(r1 * 3)\n           } yield {\n               r1 shouldBe 2\n               r2 shouldBe 6\n           }\n       // no need for tranforming the [[Task]] to [[Future]] or to awaiting for its result.\n       }\n  \n       test(\"AsyncTestSuite with Task and AssertingSyntax support\") {\n           Task(2).flatMap(r1 =\u003e Task(r1 * 3)).asserting(_ shouldBe 6)\n       }\n   }\n   ```\n\n\n## µTest\n\nAdd the following dependency to your *build.sbt*:\n\n```sbt\n\"io.monix\" %% \"monix-testing-utest\" % \"0.3.0\"\n```\n\nIt provides a wrapper conversions from [[Task]] to [[Future]].\n\n  ```scala\n   import monix.eval.Task\n   import monix.execution.Scheduler\n   import monix.testing.utest.MonixTaskTest\n   import utest.{Tests, test}\n\n   import scala.concurrent.duration._\n\nclass DummySuite extends MonixTaskTest {\n\n   override implicit val scheduler: Scheduler = Scheduler.io(\"monix-task-test\")\n\n   override val timeout = 1.second\n\n   val tests = Tests {\n      test(\"dummy test\") {\n         Task(assert(true))\n      }\n   }\n}\n  ```\n\n\n\n\n\n## Minitest\n\n\n\nMinitest is very similar to uTest, but being strongly typed:\n\nAdd the following dependency to your *build.sbt*:\n\n```sbt\n\"io.monix\" %% \"monix-testing-utest\" % \"0.3.0\"\n```\n\n```scala\n  import monix.eval.Task\n  import monix.execution.Scheduler\n  import monix.testing.minitest.MonixTaskTest\n\n  import scala.concurrent.duration._\n\nobject DummySuite extends MonixTaskTest {\n  override val timeout = 1.second // Default timeout is 10 seconds\n\n   override protected implicit val scheduler: Scheduler = Scheduler.global\n\n   test(\"dummy test\") {\n    Task(assert(true))\n  }\n}\n```\n\n\n## Specs2\n\nFinally, `specs2` can directly be used from `\"com.codecommit\" %% \"cats-effect-testing-specs2\" % \"0.5.4\"`, the latest release\nthat is compatible with monix 3.x.\n\n  ```scala\n   import monix.eval.Task\n   import monix.execution.Scheduler\n   import cats.effect.testing.specs2.CatsEffect\n   import org.specs2.mutable.Specification\n\n   import scala.concurrent.duration._\n\nimplicit val scheduler: Scheduler = Scheduler.global\n\nclass DummySpec extends Specification with CatsEffect {\n   \"dummy test\" should {\n      \"be successful\" in Task {\n         true must beTrue\n      }\n   }\n}\n  ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonix%2Fmonix-testing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonix%2Fmonix-testing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonix%2Fmonix-testing/lists"}