Fork me on GitHub

Hi. Why test-runner has no clojar version, but only gitlib?


presumably you're using this test runner because you're already using clj tooling

Alex Miller (Clojure team)14:05:13

doesn't need an artifact, so there isn't one

Alex Miller (Clojure team)14:05:56

speaking of test-runner, I was planning to spend a couple hours on it this afternoon triaging tickets and doing some clean up if anyone wants to draw my attention to anything about it


I'm using it with a lot of pleasure. That it's a git dep will give some people the impression that it's less stable than a mvn artifact, which is maybe ridiculous, but this is how some libraries are now developed: git = experimental, artifact = official. I know you're going to disagree with this, but it's what I perceived in the community.

Alex Miller (Clojure team)15:05:19

I will at least be adding a tag with a version number

Alex Miller (Clojure team)15:05:47

hoping to start changing that perception in the community soon :)


It's not a problem for me personally. I also use the cljs-test-runner which reflects the same kind of API, which is great in a .cljc project.


Whenever I see a git hash, I too think it's less stable (be that justified or not), I graviate towards things that have a version on them.


I wanna specify the -d flag to the clojure test runner and specify that option in deps.edn. Is that possible?


I was thinking :main-opts is something influencing clojure.main directly.


I see, it dispatches on the first toggle being -m, -r or whatever.


@alexmiller it would be nice if test-runner was -X -compatible


Here’s what we have at work, to be able to use it via -X:

    (let [{:keys [fail error]}
           (cond-> options
             nsrx ; need to turn strings into regexes:
             (assoc :namespace-regex (into #{} (map re-pattern) nsrx))))]
      (System/exit (if (zero? (+ fail error)) 0 1)))
      ;; Only called if `test` raises an exception
^ @alexmiller and we have that in a function like this:
(defn test
  "Invoked via exec-fn (-X) and accepts the same options that Cognitect's
  test-runner uses:

  * :dir -- set of directories containing tests
  * :namespace -- set of namespaces to test
  * :namespace-regex -- set of regex strings to match namespaces
  * :var -- set of fully qualified symbols to run tests on
  * :include -- set of test metadata keywords to filter on
  * :exclude -- set of test metadata keywords to exclude

  Mimics part of test-runner's -main function regarding
  exit code and shutdown."
  [{nsrx :namespace-regex :as options}]


What’s the benefit of -X when -M have all the equivalent functionality?

Alex Miller (Clojure team)23:05:05

Some people prefer one over the other, so now you can choose


A concrete benefit : main opts do not merge, exec args do. So you can use different aliases and combine arguments. We leverage that at work. You can't combine main opts like that.


I see. Thanks.

Alex Miller (Clojure team)15:05:47

I'm going to look at that too

Alex Miller (Clojure team)15:05:38

would leave existing support so would be additive