Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuration via TestOptions #88

Open
frgomes opened this issue Jun 21, 2017 · 0 comments
Open

Allow configuration via TestOptions #88

frgomes opened this issue Jun 21, 2017 · 0 comments

Comments

@frgomes
Copy link
Contributor

frgomes commented Jun 21, 2017

Background

SBT defines test frameworks like this:

object TestFrameworks {
  val ScalaCheck = TestFramework("org.scalacheck.ScalaCheckFramework")
  val ScalaTest =
    TestFramework("org.scalatest.tools.Framework", "org.scalatest.tools.ScalaTestFramework")
  val Specs = TestFramework("org.specs.runner.SpecsFramework")
  val Specs2 =
    TestFramework("org.specs2.runner.Specs2Framework", "org.specs2.runner.SpecsFramework")
  val JUnit = TestFramework("com.novocode.junit.JUnitFramework")
}

final class TestFramework(val implClassNames: String*) extends Serializable {
   ...
  }

ScalaTest recommends that command arguments can be passed to ScalaTest like this:

testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-oD")

More details: http://www.scalatest.org/user_guide/using_scalatest_with_sbt

Proposal

We could do something similar in sbt-doctest.

The application developer could do something like this below in his/her build.sbt:

// application developer picks one
val utestRunner = "doctest.runner.utest.Framework"
val scalaTestRunner = "doctest.runner.scalatest.Framework"
val specs2TestRunner = "doctest.runner.specs2.Framework"

val tf = new sbt.TestFramework(utestRunner)
...
testFrameworks ++= Seq(tf),
testOptions ++= Seq(Tests.Argument(tf, "--decodeHtmlEntities", "--markdownEnabled")),
...

By the way, the syntax shown above compiles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant