docspell/project/TestSettings.scala

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
895 B
Scala
Raw Permalink Normal View History

2022-02-19 13:00:47 +00:00
import sbt._
import sbt.Keys._
import docspell.build._
import sbtcrossproject.CrossProject
object TestSettingsPlugin extends AutoPlugin {
object autoImport {
def inTest(d0: Seq[ModuleID], ds: Seq[ModuleID]*) =
ds.fold(d0)(_ ++ _).map(_ % Test)
implicit class ProjectTestSettingsSyntax(project: Project) {
def withTestSettings: Project =
2022-02-19 13:00:47 +00:00
project.settings(testSettings)
def withTestSettingsDependsOn(p: Project, ps: Project*): Project =
withTestSettings.dependsOn((p +: ps).map(_ % "test->test"): _*)
2022-02-19 13:00:47 +00:00
}
implicit class CrossprojectTestSettingsSyntax(project: CrossProject) {
def withTestSettings =
project.settings(testSettings)
}
}
import autoImport._
val testSettings = Seq(
libraryDependencies ++= (Dependencies.munit ++ Dependencies.scribe).map(_ % Test),
2022-02-23 21:48:00 +00:00
testFrameworks += TestFrameworks.MUnit
2022-02-19 13:00:47 +00:00
)
}