I have the following lines in my build.sbt
fork := true
javaOptions in run += "-Dmy.environment=local"
javaOptions in test += "-Dmy.environment=local"
This works totally fine when I use the "test" command in sbt and when my code checks the jvm system settings for my.environment, it finds the correct value (i.e., "local").
The problem that I am having is that when I run "test-only org.whatever.SomeTest" in this case the my.environment key isn't in the jvm system settings. Specifically, System.getProperty("my.environment") is null whereas it was "local" when I just ran "test".
Does anyone know how to fix this?
You are likely hitting #975: regression: fork in test doesn't work anymore, which is currently under review. Try:
javaOptions in Test += "-Dmy.environment=local"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With