Open frgomes opened 7 years ago
@lloydmeta : The idea is that the user determines which test framework and which version of libraries the user needs. As far as I understand, ScalaTest changed the location of checkers and so, in this case, sbt-doctest
must be prepared to provide these two flavours.
Ideally, sbt-doctest
should not have any hardcoded stuff. However, for maximum convenience, we could refactor the harcoded stuff, keeping it in certain specific locations. Borrowing the example from #88, we could have something like this:
build.sbt
more or less like this:val scalaTestRunner = "doctest.runner.scalatest.v30.Framework"
val argsDocTest: Seq[String] = ...
val argsScalaTest: Seq[String] = ... // see: http://www.scalatest.org/user_guide/using_the_runner
val args = argsDocTest :: "--" :: argsScalaTest
...
val tf = new sbt.TestFramework(utestRunner)
testFrameworks ++= Seq(tf),
testOptions ++= Seq(Tests.Argument(tf, args)),
...
In this case, the class doctest.runner.scalatest.v30.Framework
configures a certain setting which says that org.scalatest.prop.Checkers
must be employed.
doctest.runner.scalatest.v31.Framework
is employed, it will configure a setting which says that org.scalatest.check.Checkers
must be used instead.Please let me know what you think. Suggestions are welcome! :-)
@tkawachi : your feedback, please.
My only recommendation is that whatever solution is taken, that there be a reasonable default provided by this plugin that requires no additional configuration from the end user (e.g. add the this plugin and doctests "should work"). It could, for example that sbt-doctest works out of the box with Scalatest+Scalacheck for mindshare and legacy reasons, and the user can configure it to do otherwise, if they so wish.
This plugin generates tests, but not run these. By seeing Framework.java, it seems not for a test generator.
I'm rather thinking to add ScalaTest31 as a subclass of DoctestTestFramework.
withCheckers()
is only used by ScalaTestGen. It is moved to ScalaTestGen at #92.
I've noticed that
TestGen
containssbt-doctest
should not assume that the user is always going to use ScalaTest + ScalaCheck.I the case of ScalaJS, chances that the application developer is employing uTest both in the JVM side and JS side. So this issue seems to be related to #52