Skip to content

Get resource path in test #3586

Answered by lihaoyi
reidrac asked this question in Q&A
Sep 20, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

@reidrac It seems like the the classpath ordering changed which would cause the resource path to resolve differently. In general, you shouldn't rely on classpath ordering, since we can't really guarantee it remains stable over time.

In Mill 0.12.0, we provide a sys.env("MILL_TEST_RESOURCE_FOLDER") environment variable that you can use. For 0.11.12, you can emulate it via the following override

def forkEnv = super.forkEnv() ++
        Map("MILL_TEST_RESOURCE_FOLDER" -> resources().map(_.path).mkString(";")),

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@reidrac
Comment options

Answer selected by reidrac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants