开发者

Selectively run tests in broken project using SBT

开发者 https://www.devze.com 2023-02-20 06:25 出处:网络
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开发

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消