Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Play 2.3.7 when fork in Test = false config options are ignored

I'm using play 2.3.7 When fork in Test := false in my build.sbt the conf files aren't loaded by play when running tests.

The line javaOptions in Test += "-Dconfig.file=conf/test.conf" in my build.sbt should load the test.conf when running tests but that's not happening.

The workaround is to run activator and pass the above param on the command line like so:

activator -Dconfig.file=conf/test.conf "test-only test.integration.SomeTest"

If I remove fork in Test := false then all is good and play finds the conf resources - but then of course I can't step through tests which sucks.

What am I missing in my build.sbt ? Is this a bug in play?

like image 563
xtrakBandit Avatar asked Oct 23 '25 18:10

xtrakBandit


1 Answers

Forking the tests means that you run then on a separate JVM.

Not forking the tests means that they are run in the same JVM as SBT itself and you cannot change the parameters that the JVM was started with after it already has been started.

The only solution if you do not want to fork is to pass all those flags to the JVM that SBT runs on when you start it, just like you mention in the end of your question.

like image 110
johanandren Avatar answered Oct 26 '25 06:10

johanandren



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!