Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

middleware.test: offer fail-fast functionality #709

Closed
vemv opened this issue Sep 13, 2021 · 1 comment · Fixed by #783
Closed

middleware.test: offer fail-fast functionality #709

vemv opened this issue Sep 13, 2021 · 1 comment · Fixed by #783

Comments

@vemv
Copy link
Member

vemv commented Sep 13, 2021

It would be sweet to offer fail-fast functionality. Under it:

  • The first failing failing test var fails that ns; and
  • The first failing ns fails the test run.

Relevant code:

(doseq [v vars]
(each-fixture-fn (fn [] (test-var v))))))

(doseq [[ns vars] (group-by
(comp :ns meta)
(query/vars var-query))]
(test-ns ns vars))

Some inspiration:

(defn run-tests
  "Like clojure.test/run-tests, but fails fast."
  [& namespaces]
  (let [summary (-> (->> namespaces
                         (reduce (bound-fn [r n]
                                   (let [{:keys [fail error]
                                          :as v} (clojure.test/test-ns n)
                                         failed? (some pos? [fail error])
                                         ret (merge-with + r v)]
                                     (cond-> ret
                                       failed? reduced)))
                                 clojure.test/*initial-report-counters*))
                    (assoc :type :summary))]
    (clojure.test/do-report summary)
    summary))
@bbatsov
Copy link
Member

bbatsov commented Sep 19, 2021

Yeah, that'd be great. It has been on the TODO list for as long as the middleware existed, alongside async reporting of the progress. The fail-fast is definitely easier to implement, though.

@vemv vemv self-assigned this Jul 18, 2023
vemv added a commit that referenced this issue Jul 21, 2023
vemv added a commit that referenced this issue Jul 21, 2023
vemv added a commit that referenced this issue Jul 21, 2023
@vemv vemv closed this as completed in #783 Jul 21, 2023
vemv added a commit that referenced this issue Jul 21, 2023
Fixes #709

Introduces fail-fast via a `"fail-fast"` msg param. The default is to not fail-fast.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants