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:
lazy val justTestOnly = testQuickMethod(testCompileConditional.analysis, testOptions)(
o => testTask(testFrameworks, testClasspath, testCompileConditional.analysis, o)
)
It does the same thing that testOnly
does - forwards the task creation to a helper called testQuickMethod
. The only difference is in the function it gives it in the 2nd parameter list - it uses test options o
to create a Task
using the testTask
method, but without appending the dependsOn
at the end.
Appending dependsOn
to testTask
could be used to create some dependencies for this task.
精彩评论