Skip to content

Commit

Permalink
Merge pull request #94 from tindzk/feat/init-munit
Browse files Browse the repository at this point in the history
Scaffold: Add option for MUnit testing framework
  • Loading branch information
tindzk authored Apr 25, 2020
2 parents dffd692 + 206f0a7 commit 66bb633
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ If you add a test framework, make sure that `testFrameworks` in `project` contai
* **ScalaCheck:** `org.scalacheck.ScalaCheckFramework`
* **MiniTest:** `minitest.runner.Framework`
* **µTest:** `utest.runner.Framework`
* **MUnit:** `munit.Framework`

In Bloop, you can run the test suites as follows: `bloop test myModule` which is short for `bloop test myModule-test`. The latter depends on `myModule-js-test` and `myModule-jvm-test`.

Expand Down
18 changes: 10 additions & 8 deletions src/main/scala/seed/cli/Scaffold.scala
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,23 @@ class Scaffold(log: Log, silent: Boolean = false) {
log.info(
s"${Ansi.italic("Which test framework(s) do you need?")} [default: ${Ansi.underlined("none")}]"
)
log.infoHighlight(s"${Ansi.bold("1.")} minitest")
log.infoHighlight(s"${Ansi.bold("2.")} ScalaTest")
log.infoHighlight(s"${Ansi.bold("3.")} ScalaCheck")
log.infoHighlight(s"${Ansi.bold("4.")} µTest")
log.infoHighlight(s"${Ansi.bold("1.")} MUnit")
log.infoHighlight(s"${Ansi.bold("2.")} minitest")
log.infoHighlight(s"${Ansi.bold("3.")} ScalaTest")
log.infoHighlight(s"${Ansi.bold("4.")} ScalaCheck")
log.infoHighlight(s"${Ansi.bold("5.")} µTest")

import TestFramework._
readInput[Set[TestFramework]](
Set(), {
case "none" => Some(Set())
case input =>
val result = input.split(",").map(u => Try(u.trim.toInt)).map {
case Success(1) => Some(Minitest)
case Success(2) => Some(ScalaTest)
case Success(3) => Some(ScalaCheck)
case Success(4) => Some(Utest)
case Success(1) => Some(MUnit)
case Success(2) => Some(Minitest)
case Success(3) => Some(ScalaTest)
case Success(4) => Some(ScalaCheck)
case Success(5) => Some(Utest)
case _ => None
}

Expand Down
1 change: 1 addition & 0 deletions src/main/scala/seed/model/Artefact.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ object Artefact {
val ScalaNativeAuxlib =
Artefact("org.scala-native", "auxlib", Some(PlatformBinary))

val MUnit = Artefact("org.scalameta", "munit", Some(PlatformBinary))
val Minitest = Artefact("io.monix", "minitest", Some(PlatformBinary))
val ScalaTest = Artefact("org.scalatest", "scalatest", Some(PlatformBinary))
val ScalaCheck =
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/seed/model/TestFramework.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ sealed abstract class TestFramework(
)

object TestFramework {
case object MUnit extends TestFramework(Artefact.MUnit, "munit.Framework")
case object Minitest
extends TestFramework(Artefact.Minitest, "minitest.runner.Framework")
case object ScalaTest
Expand Down

0 comments on commit 66bb633

Please sign in to comment.