Allow test selectors and namespaces to be specified in the same run.
This commit is contained in:
parent
fa2a0a0f47
commit
38347be0fc
3 changed files with 7 additions and 5 deletions
|
@ -215,7 +215,8 @@ Then add a :test-selectors map to project.clj:
|
|||
|
||||
Now if you run "lein test" it will only run deftests that don't have
|
||||
:integration metadata, while "lein test :integration" will only run
|
||||
the integration tests and "lein test :all" will run everything.
|
||||
the integration tests and "lein test :all" will run everything. You
|
||||
can include test selectors and listing test namespaces in the same run.
|
||||
|
||||
Because it starts a new JVM process, lein test is not a good solution
|
||||
for test-driven development. For that you would either need to look
|
||||
|
|
|
@ -38,7 +38,7 @@ each namespace and print an overall summary."
|
|||
(let [args (map read-string args)
|
||||
nses (if (or (empty? args) (every? keyword? args))
|
||||
(sort (namespaces-in-dir (:test-path project)))
|
||||
args)
|
||||
(filter symbol? args))
|
||||
selectors (map (:test-selectors project) (filter keyword? args))
|
||||
selectors (if (and (empty? selectors)
|
||||
(:default (:test-selectors project)))
|
||||
|
@ -56,8 +56,6 @@ tests. If none are given, runs them all." ; TODO: update
|
|||
(require '[clojure walk template stacktrace]))
|
||||
(let [[nses selectors] (read-args tests project)
|
||||
result (doto (File/createTempFile "lein" "result") .deleteOnExit)]
|
||||
(when-not (or (every? symbol? nses) (every? keyword? nses))
|
||||
(throw (Exception. "Args must be either all namespaces or keywords.")))
|
||||
(eval-in-project project (form-for-testing-namespaces
|
||||
nses (.getAbsolutePath result) (vec selectors))
|
||||
nil nil `(do (require '~'clojure.test)
|
||||
|
|
|
@ -13,4 +13,7 @@
|
|||
:main nom.nom.nom
|
||||
:warn-on-reflection true
|
||||
:shell-wrapper {:main nom.nom.nom
|
||||
:bin "bin/nom"})
|
||||
:bin "bin/nom"}
|
||||
:test-selectors {:integration :integration
|
||||
:default (complement :integration)
|
||||
:all (constantly true)})
|
||||
|
|
Loading…
Reference in a new issue