admin管理员组文章数量:1289910
I've had this issue in a project of mine and I've setup a minimal example reproducing the issue, it took me a while to figure out the problem.
But it seems that when I set Test / envVars
in my build.sbt
they aren't propagated to tests in a sub project
This is my build.sbt
ThisBuild / scalaVersion := "3.3.1"
Test / envVars := Map("TEST" -> "TEST_ENVVARS")
Test / fork := true
lazy val subProject = project
.in(file("sub-project"))
.settings(
libraryDependencies ++= Seq(
".scalatest" %% "scalatest" % "3.2.9" % Test
)
)
lazy val root = project
.in(file("."))
.aggregate(subProject)
.settings(
libraryDependencies ++= Seq(
".scalatest" %% "scalatest" % "3.2.9" % Test
)
)
I have two identical tests, one in the "root" of the project and one in "sub-project" directory
src/test/scala/example/RootExampleTest.scala
and sub-project/src/test/scala/example/SubProjectExampleTest.scala
They both look like this with the exception of the class name
package example
import .scalatest.flatspec.AnyFlatSpec
import scala.util.Properties
class RootExampleTest extends AnyFlatSpec {
"RootExampleTest" should "read envVars" in {
assert(Properties.envOrNone("TEST").nonEmpty)
}
}
when I run the test with sbt test
the SubProjectExampleTest
fails but the RootExampleTest
succeeds.
I was expecting that the sub-project would also have the envVars propagated
本文标签: scalasbt envVars not propagated to subprojectsStack Overflow
版权声明:本文标题:scala - sbt envVars not propagated to sub-projects - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741456208a2379771.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论