Fork me on GitHub
#tools-deps
<
2021-03-05
>
sofra04:03:41

Hi, I just upgraded to the latest version. I used to setup my test runner like this

:runner  {:extra-paths ["test"]
                     :extra-deps  {lambdaisland/kaocha {:mvn/version "1.0.641"}}
                     :main-opts   ["-m" "kaocha.runner"]}
this now gives my deprecation warnings
❯ clj -A:test:runner --focus unit
WARNING: When invoking clojure.main, use -M
but after reading the docs I am not sure how to address them

seancorfield05:03:50

@sofra Use clj -M:test:runner --focus unit

seancorfield05:03:30

With the introduction of -X for function execution, -M has been expanded from just :main-opts to include deps/paths as well and is how you should run anything relying on clojure.main (`:main-opts`). -A is going to be reserved for starting a REPL in due course (but still functions as before, except with that warning).

sofra05:03:28

thanks @seancorfield for the explanation

sofra05:03:33

I had tried with -M instead of -A but it seems to look for the kaocha.runner as a file on the file system then

❯ clj -M:test:runner --focus unit
Execution error (FileNotFoundException) at java.io.FileInputStream/open0 (FileInputStream.java:-2).
kaocha.runner (No such file or directory)

dpsutton05:03:17

I think kaocha is looking for a config file?

seancorfield05:03:16

@sofra I just created a brand new project and put this in it:

:aliases
 {:test {:extra-paths ["test"]
         :extra-deps {org.clojure/test.check {:mvn/version "1.1.0"}}}
  :runner  {:extra-paths ["test"]
                     :extra-deps  {lambdaisland/kaocha {:mvn/version "1.0.641"}}
                     :main-opts   ["-m" "kaocha.runner"]}
 ...}
and it works fine for me:
$ clojure -M:test:runner --focus unit
[(F)]
Randomized with --seed 150177492

FAIL in sofra.example-test/a-test (example_test.clj:7)
FIXME, I fail.
Expected:
  0
Actual:
  -0 +1
1 tests, 1 assertions, 1 failures.

seancorfield05:03:37

I think perhaps you changed your :main-opts?

seancorfield05:03:22

That's with the latest prerelease:

$ clojure --version
Clojure CLI version 1.10.2.801
but I can try it with the latest stable version...

sofra05:03:11

hmmm, thanks … my bad, it does seem to work now, not sure what it was

sofra05:03:01

yeah strange, sorry for the noise, it is working 🙂

1
seancorfield05:03:52

(I just double-checked it works with 1.10.2.790 as well)