Following on from this question on running sbt tests in a broken build, how can I enhance the just-test action below so that it has similar functionality to test-only. I.e. just-test-only *SomeTest
import sbt._
class Project(info: ProjectInfo) extends DefaultProject(info) {
lazy val justTest = testTask(testFrameworks, testClasspath, testCompileConditional.analysis, testOptions)
}
This guy should do the trick:
It does the same thing that
testOnlydoes – forwards the task creation to a helper calledtestQuickMethod. The only difference is in the function it gives it in the 2nd parameter list – it uses test optionsoto create aTaskusing thetestTaskmethod, but without appending thedependsOnat the end.Appending
dependsOntotestTaskcould be used to create some dependencies for this task.