Reputation: 133
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?
Upvotes: 4
Views: 1241
Reputation: 11479
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.
Upvotes: 4