Run all tests in IntelliJ

To me it sounds risky to change the way the IDE is configured to resole relative file paths. Are you sure that’s safe?

What is $PROJECT_DIR? By this do you mean the value of the UNIX environment variable PROJECT_DIR ? Or does the $ have some special meaning other than shell variable interpolation?

I ask because I apparently do not have any such environment variable.

import sys.process._

"printenv".!

… produces the following output

import sys.process._

TMPDIR=/var/folders/ry/dmz1d8k97sv7hlfy0fr7zcnc0000gq/T/
__CF_USER_TEXT_ENCODING=0x1F7:0x0:0x0
HOME=/Users/jnewton
SHELL=/bin/csh
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.QKBApjg6am/Render
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.guZ2l0A8EW/Listeners
PATH=/usr/bin:/bin:/usr/sbin:/sbin
LOGNAME=jnewton
DISPLAY=/private/tmp/com.apple.launchd.rjMFCLeXIn/org.macosforge.xquartz:0
XPC_SERVICE_NAME=com.jetbrains.intellij.ce.55712
USER=jnewton
XPC_FLAGS=0x0
JAVA_MAIN_CLASS_78564=org.jetbrains.plugins.scala.nailgun.NailgunRunner
res0: Int = 0

Mmk… I’d recommend against that - this way the tests will work on your specific machine only. Tests should be self-contained within the project. If you really don’t want to add the files to your project, I’d at least have the tests read a system property for the location of the test files directory, thus rendering the whole relative paths issue obsolete.

scala.io.Source, as mentioned a few lines above.

First, you’d only change it for the specific launch configuration, not the overall IDE config. Second, you shouldn’t change it but rely on the default (which is the same for sbt, BTW).

I don’t understand why the tests would work only on my specific machine. My intent was that the tests would work for anyone who clones the git repo, regardless of the physical location the clone occurs.

I admit I don’t know anything about running it on windows. I’d be surprised if it works at all on non-Unix systems.

The root directory of your project.

Yes,sorry my question was unclear. I understood the semantics of $PROJECT_DIR was the root directory of the project. My question was regarding the syntax. Is it intended to be a shell string interpolation? Or is $thisandthat a syntax interpreted by the Scala/java Source.fromFile method and friends?

I see. My assumption was that scope of the git repo is the project only. In that case a relative path from the project root is kind of ok.

Ah, ok, sorry. To my knowledge there is no dedicated environment variable/system property of this name. This was just intended as a placeholder - make it <project root>/testfiles, then.

I see; in my case the research project in the sense of the git repo is much older than the part which is a scala implementation of some of the algorithms. The scala specific sub-directory contains what the java-ecosystem also refers to as the project. So project is a pretty ambiguous term in the end.