Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
aa02d6a
Change test dependency to Weaver 0.11.3
Hombre-x Apr 14, 2026
da1bea1
Update documentation
Hombre-x Apr 15, 2026
30584d7
Change base TL version since it's a breaking change
Hombre-x Apr 15, 2026
82dcafc
Update suite to accommodate the Weaver test style
Hombre-x Apr 15, 2026
b51b475
Change the CLI process to use Expectations instead of the old MUnit f…
Hombre-x Apr 15, 2026
a9bdd3d
Format files before PR
Hombre-x Apr 15, 2026
4d70240
Address copilot suggestions
Hombre-x Apr 15, 2026
2af1c19
Format build.sbt
Hombre-x Apr 15, 2026
e48f01b
Bump minimum Scala 2 version
Hombre-x Apr 15, 2026
fa4a760
Bump sbt version, tl plugin and scala js
Hombre-x Apr 15, 2026
7ccf425
Change to scala version key to solve Bloop bride problem
Hombre-x Apr 15, 2026
6c917ea
Update workflow to lastest version
Hombre-x Apr 15, 2026
e6683fd
Use platform version for each of the headers on the tests
Hombre-x Apr 15, 2026
1faf067
Bump scala-cli version
Hombre-x Apr 15, 2026
92632fa
Merge branch 'main' into weaver-migration
Hombre-x Apr 15, 2026
f828714
Update Weaver to 0.12.0
Hombre-x Apr 15, 2026
1d37ff1
Format files before PR
Hombre-x Apr 15, 2026
b75e376
Update Site to Navite 0.5
Hombre-x Apr 15, 2026
8f537f1
Increate test execution time
Hombre-x Apr 15, 2026
6e3d782
Merge branch 'main' into weaver-migration
Hombre-x Apr 15, 2026
b12f70c
Decrease parallelism
Hombre-x Apr 15, 2026
a4e5e48
Use better combinators
Hombre-x Apr 16, 2026
ef4f447
Match time on run comment
Hombre-x Apr 16, 2026
eb8f4d7
Update parallelism (more like concurrency) comment
Hombre-x Apr 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A toolkit of great libraries to get started building Typelevel apps on JVM, Node.js, and Native! Our very own flavour of the [Scala Toolkit].

```scala
```scala 3
Comment thread
armanbilge marked this conversation as resolved.
//> using toolkit typelevel:default

import cats.effect.*
Expand All @@ -25,7 +25,7 @@ scala-cli --power new typelevel/toolkit.g8
* [http4s Ember client]
* [Circe] and http4s integration
* [Decline Effect]
* [Munit Cats Effect]
* [Weaver Test]

[Scala Toolkit]: https://docs.scala-lang.org/toolkit/introduction.html
[Cats]: https://typelevel.org/cats
Expand All @@ -36,4 +36,4 @@ scala-cli --power new typelevel/toolkit.g8
[http4s Ember Client]: https://http4s.org/v0.23/docs/client.html
[Circe]: https://circe.github.io/circe/
[Decline Effect]: https://ben.kirw.in/decline/effect.html
[Munit Cats Effect]: https://github.com/typelevel/munit-cats-effect
[Weaver Test]: https://github.com/typelevel/weaver-test
11 changes: 5 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import laika.helium.config._
import laika.config.{ChoiceConfig, Selections, SelectionConfig}
import java.io.File

ThisBuild / tlBaseVersion := "0.1"
ThisBuild / tlBaseVersion := "0.2"
ThisBuild / startYear := Some(2023)
ThisBuild / tlSitePublishBranch := Some("main")
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("17"))
Expand Down Expand Up @@ -40,8 +40,7 @@ lazy val toolkitTest = crossProject(JVMPlatform, JSPlatform, NativePlatform)
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % "2.13.0",
"org.typelevel" %%% "cats-effect-testkit" % "3.7.0",
"org.scalameta" %%% "munit" % "1.3.0", // not % Test, on purpose :)
"org.typelevel" %%% "munit-cats-effect" % "2.2.0"
"org.typelevel" %%% "weaver-cats" % "0.12.0" // not % Test, on purpose :)
),
libraryDependencySchemes += "org.scala-native" %% "test-interface_native0.5" % VersionScheme.Always,
mimaPreviousArtifacts := Set()
Expand All @@ -52,7 +51,7 @@ lazy val tests = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.settings(
name := "tests",
libraryDependencies ++= Seq(
"org.typelevel" %%% "munit-cats-effect" % "2.2.0" % Test,
"org.typelevel" %%% "weaver-cats" % "0.12.0" % Test,
"co.fs2" %%% "fs2-io" % "3.13.0" % Test,
"org.virtuslab.scala-cli" %% "cli" % "1.13.0" cross (CrossVersion.for2_13Use3)
),
Expand Down Expand Up @@ -117,8 +116,8 @@ lazy val docs = project
"Cats Effect"
),
TextLink.external(
"https://github.com/typelevel/munit-cats-effect",
"Munit Cats Effect"
"https://github.com/typelevel/weaver-test",
"Weaver Test"
)
)
)
Expand Down
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Typelevel toolkit is a meta library that currently includes these libraries:
- [Http4s Ember client]
- [Circe] and http4s integration
- [Decline Effect]
- [Munit Cats Effect]
- [Weaver Test]

and it's published for Scala 2.13 and 3.3+.

Expand Down Expand Up @@ -85,7 +85,7 @@ Enumerations in your codebase, see [this comment] for more info.
[Http4s Ember Client]: https://http4s.org/v0.23/docs/client.html
[Circe]: https://circe.github.io/circe/
[Decline Effect]: https://ben.kirw.in/decline/effect.html
[Munit Cats Effect]: https://github.com/typelevel/munit-cats-effect
[Weaver Test]: https://github.com/typelevel/weaver-test

[this Enumeration method]: https://github.com/scala/scala/blob/v2.13.8/src/library/scala/Enumeration.scala#L190-L215=
[this comment]: https://github.com/typelevel/cats-effect/issues/3051#issuecomment-1167026949
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,22 @@ package org.typelevel.toolkit

import cats.effect.kernel.Resource
import cats.effect.IO
import cats.syntax.parallel._
import cats.syntax.parallel.*
import buildinfo.BuildInfo
import fs2.Stream
import fs2.io.file.Files
import fs2.io.process.ProcessBuilder
import munit.Assertions.fail
import weaver.{Expectations, SourceLocation}
import weaver.Expectations.Helpers.{failure, success}

object ScalaCliProcess {

private val ClassPath: String = BuildInfo.classPath
private val JavaHome: String = BuildInfo.javaHome

private def scalaCli(args: List[String]): IO[Unit] = ProcessBuilder(
private def scalaCli(args: List[String])(implicit
loc: SourceLocation
): IO[Expectations] = ProcessBuilder(
s"$JavaHome/bin/java",
args.prependedAll(List("-cp", ClassPath, "scala.cli.ScalaCli"))
).spawn[IO]
Expand All @@ -40,7 +43,7 @@ object ScalaCliProcess {
process.stdout.through(fs2.text.utf8.decode).compile.string,
process.stderr.through(fs2.text.utf8.decode).compile.string
).parFlatMapN {
Comment thread
Hombre-x marked this conversation as resolved.
Outdated
case (0, _, _) => IO.unit
case (0, _, _) => IO.pure(success)
case (exitCode, stdout, stdErr) =>
val errorMessage: String = List(
Option(stdout).filter(_.nonEmpty).map(s => s"[STDOUT]: $s"),
Expand All @@ -52,7 +55,7 @@ object ScalaCliProcess {
case (summary, None) => summary
}

IO.delay(fail(errorMessage))
IO.pure(failure(errorMessage))
}
)

Expand All @@ -79,12 +82,13 @@ object ScalaCliProcess {
}
.map(_.toString)

def command(args: List[String]): IO[Unit] = scalaCli(args)
def command(args: List[String])(implicit
loc: SourceLocation
): IO[Expectations] = scalaCli(args)

def run(body: String): IO[Unit] =
def run(body: String)(implicit loc: SourceLocation): IO[Expectations] =
writeToFile(body)(false).use(f => scalaCli("run" :: f :: Nil))

def test(body: String): IO[Unit] =
def test(body: String)(implicit loc: SourceLocation): IO[Expectations] =
writeToFile(body)(true).use(f => scalaCli("test" :: f :: Nil))

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@

package org.typelevel.toolkit

import munit.{CatsEffectSuite, TestOptions}
import cats.effect.IO
import buildinfo.BuildInfo.scala3
import scala.concurrent.duration._
import weaver.*
import scala.concurrent.duration.*

class ToolkitCompilationTest extends CatsEffectSuite {
object ToolkitCompilationTest extends SimpleIOSuite {
Comment thread
armanbilge marked this conversation as resolved.

// 2 minutes may seem a lot, but consider that the first test for
Comment thread
Hombre-x marked this conversation as resolved.
Outdated
// each (scalaVersion, platform) will have to download the compiler
// (if it's not the default), compile (that for native takes awhile)
// and then finally run the code.
override def munitIOTimeout: Duration = 2.minute
private val TestTimeout = 4.minutes

testRun("Toolkit should run a simple Hello Cats Effect") {
if (scala3)
Expand Down Expand Up @@ -67,26 +68,36 @@ class ToolkitCompilationTest extends CatsEffectSuite {
|}"""
}

testTest("Toolkit should execute a simple munit suite") {
testTest("Toolkit should execute a simple weaver suite") {
if (scala3)
"""|import cats.effect.*
|import munit.*
"""|import cats.effect.IO
|import weaver.*
|
|class Test extends CatsEffectSuite:
| test("test")(IO.unit)"""
|object Test extends SimpleIOSuite:
| test("test")(IO.pure(success))"""
else
"""|import cats.effect._
|import munit._
"""|import cats.effect.IO
|import weaver._
|
|class Test extends CatsEffectSuite {
| test("test")(IO.unit)
|object Test extends SimpleIOSuite {
| test("test")(IO.pure(success))
|}"""
}

def testRun(testName: TestOptions)(scriptBody: String): Unit =
test(testName)(ScalaCliProcess.run(scriptBody))
private def withTimeout(test: IO[Expectations]): IO[Expectations] =
test.timeoutTo(
TestTimeout,
IO.pure(failure(s"Test exceeded timeout of $TestTimeout"))
)
Comment thread
Hombre-x marked this conversation as resolved.

def testRun(testName: String)(scriptBody: String): Unit =
test(testName) {
withTimeout(ScalaCliProcess.run(scriptBody))
}

def testTest(testName: TestOptions)(scriptBody: String): Unit =
test(testName)(ScalaCliProcess.test(scriptBody))
def testTest(testName: String)(scriptBody: String): Unit =
test(testName) {
withTimeout(ScalaCliProcess.test(scriptBody))
}

}