mpizenberg / elm-test-rs

Fast and portable executable to run your Elm tests
BSD 3-Clause "New" or "Revised" License
80 stars 13 forks source link

Add a --root CLI argument #56

Closed mpizenberg closed 3 years ago

mpizenberg commented 3 years ago

elm-test-rs was already able to pick up an elm.json in a parent directory, but not in a subdirectory. You can now run elm-test-rs from outside of the project and add the --root /path/to/elm.json/directory option and it should work as if you run elm-test-rs from that directory.

This is in response to the following comment: https://discourse.elm-lang.org/t/gathering-feedback-on-elm-test-rs-before-1-0-release/6851/7

harrysarson commented 3 years ago

In terms of the CLI flag there is precident (I am thinking of make) for a -C DIR flag which changes to the directory before the rest of the program runs. For consistancy it might we worth copying this pattern for elm-test-rs. Just a thought :)


For reference:

       -C dir, --directory=dir
            Change to directory dir before reading the makefiles or
            doing anything else.  If multiple -C options are specified,
            each is interpreted relative to the previous one: -C / -C
            etc is equivalent to -C /etc.  This is typically used with
            recursive invocations of make.
mpizenberg commented 3 years ago

In terms of the CLI flag there is precident (I am thinking of make) for a -C DIR flag which changes to the directory before the rest of the program runs. For consistancy it might we worth copying this pattern for elm-test-rs. Just a thought :)

I didn't know about that, good point. It's not exactly that though since the paths to tests files passed as arguments is still relative to where you run the command ...

harrysarson commented 3 years ago

since the paths to tests files passed as arguments

Of course ignore me then...


Unless I may propose -p DIR, --project DIR a la typescript. Otherwise root sounds good!

mpizenberg commented 3 years ago

Unless I may propose -p DIR, --project DIR a la typescript.

--project sounds nice too! I'm not the primary user for this so I'll probably wait for interested people to give their preference.

Also by the way, copying the behavior of gnu make -C could make sense! It's just that not doing it was a rather easy fix XD. What is the behavior of the typescript --project option? Do you have command line arguments with paths to files when using the typescript compiler?