Skip to content

Latest commit

 

History

History
53 lines (48 loc) · 1.6 KB

install-munit.md

File metadata and controls

53 lines (48 loc) · 1.6 KB

{% altDetails install-info-box 'Getting MUnit' %}

{% tabs munit-unit-test-1 class=tabs-build-tool %} {% tab 'Scala CLI' %} You can require the entire toolkit in a single line:

//> using toolkit latest

MUnit, being a testing framework, is only available in test files: files in a test directory or ones that have the .test.scala extension. Refer to the Scala CLI documentation to learn more about the test scope.

Alternatively, you can require just a specific version of MUnit:

//> using dep org.scalameta::munit:1.1.0

{% endtab %} {% tab 'sbt' %} In your build.sbt file, you can add the dependency on toolkit-test:

lazy val example = project.in(file("."))
  .settings(
    scalaVersion := "3.4.2",
    libraryDependencies += "org.scala-lang" %% "toolkit-test" % "0.7.0" % Test
  )

Here the Test configuration means that the dependency is only used by the source files in src/test.

Alternatively, you can require just a specific version of MUnit:

libraryDependencies += "org.scalameta" %% "munit" % "1.1.0" % Test

{% endtab %} {% tab 'Mill' %} In your build.sc file, you can add a test object extending Tests and TestModule.Munit:

object example extends ScalaModule {
  def scalaVersion = "3.4.2"
  object test extends Tests with TestModule.Munit {
    def ivyDeps =
      Agg(
        ivy"org.scala-lang::toolkit-test:0.7.0"
      )
  }
}

Alternatively, you can require just a specific version of MUnit:

ivy"org.scalameta::munit:1.1.0"

{% endtab %} {% endtabs %} {% endaltDetails %}