This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-29
Channels
- # announcements (3)
- # aws (12)
- # babashka (11)
- # beginners (46)
- # calva (10)
- # cider (6)
- # clara (3)
- # cljdoc (6)
- # cljs-dev (13)
- # cljsrn (2)
- # clojure (49)
- # clojure-europe (2)
- # clojure-gamedev (1)
- # clojure-germany (22)
- # clojure-uk (2)
- # clojurescript (28)
- # clojureverse-ops (8)
- # conjure (6)
- # cursive (2)
- # emacs (1)
- # figwheel-main (9)
- # heroku (12)
- # jobs-discuss (1)
- # malli (10)
- # off-topic (1)
- # practicalli (8)
- # re-frame (25)
- # reagent (6)
- # shadow-cljs (24)
- # testing (10)
- # vscode (4)
Hi, running my tests always returns with exit code 0 even when some tests fail. This makes running the test suite in CI useless. Am I doing something wrong or how do others run their tests in CI?
lein test
returns non zero error code when test fails. What do you use to run tests?
right now my work-around looks something like this:
(defn -main []
(let [{:keys [fail error]} (test-all)]
(System/exit (if (zero? (+ fail error)) 0 1))))
And test-all
is just a function that finds all my namespaces and runs (apply run-tests namespaces)
And I execute the program with clj -M:test
. So, it kind of works thanks to the System/exit call but that feels like a hack
I don't use deps, but last time I've looked into it people used test runners like https://github.com/cognitect-labs/test-runner or https://github.com/lambdaisland/kaocha. With those you could remove logic that discovers tests and produces exit code
@U01E2D1JLMC We use Cognitect’s test-runner
in our BitBucket Pipelines CI at work and like it a lot (especially now it has the -X
/ exec args invocation so we can merge test arguments across multiple aliases.
(you can’t merge :main-opts
across aliases — but you can merge :exec-args
!)
You've basically created your own minimal test runner @U01E2D1JLMC :)