rcf
rcf copied to clipboard
Support for `assert-expr` multimethod
I'm loving this and I want to use it with humane-test-output, https://github.com/pjstadig/humane-test-output. Do you have any guide on how to do it?
Thank you for giving RCF a shot, and thank you for the warm comment 😊 For now RCF is not compatible with Humane-Test-Output out of the box.
The :fail
test reporter is the interesting bit, which pretty prints failed assertions nicely (diffed, formatted, etc…).
This should do the trick:
- overload RCF’s default reporter (using
defmethod clojure.test/report
), like here. - compute the diff (like HTO is doing) inside the reporter
- call into HTO’s reporter
This should be doable without having to patch RCF:
(defmethod clojure.test/report :fail [{:keys [expected actual] :as event}]
(pjstadig.util/report- (assoc event :diffs (compute-diff expected actual))))
But pjstadig.util/report-
is defined as private…
A cleaner way would be for RCF to support assert-expr
, which would make it compatible with HTO out of the box.
I’ll keep this issue open and rename it to track the need of assert-expr
.
The issue is that humane-test-output is meant to self-install on require. For RCF to support this, RCF must be changed to support clojure.test/assert-expr, which is the multimethod hook humane-test-output uses to self-install.