sbt / sbt

sbt, the interactive build tool
https://scala-sbt.org
Apache License 2.0
4.81k stars 937 forks source link

Test task doesn't use actual fork value #3832

Open dos65 opened 6 years ago

dos65 commented 6 years ago

steps

Setup project with following build.sbt:

libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1"
fork in (Test, test) := true
javaOptions in (Test, test) ++= Seq("-Dkey=value")

add test in src/main/test and run sbt test

problem

Sbt doesn't actually fork test execution, test from gist always fail. Sometimes it's possible to see a warning about it:

[warn] javaOptions will be ignored, fork is set to false

expectation

Should use fork value.

notes

That problem appeared from 1.0.0. For test it applies changes only for Config.

fork in Test := true // ok
fork in IntegrationTest := true // ok

I tried to reproduce the same behavior of fork in run, but it works well:

fork in (Test, run) := true // ok
fork in (Compile, run) := true // ok

sbt version: 1.1.0-RC2

eed3si9n commented 6 years ago

Thanks for the detailed report.