Closed plexus closed 5 years ago
I'll give a shot at patching fulcro-spec. Thanks for the details.
spec 2.1.3 sets the multimethods in t/report to do nothing for the special events. This cleans up the output.
Hi @awkay, Kaocha is now more conservative in what it sends to t/report
, it will only forward events if there is a (non-default) implementation of t/report
that will handle it.
I know it's no longer an issue for Fulcro but if people are using other assertion libraries this might prevent them getting some very noisy output.
Thanks for the input and for trying out Kaocha!
fulcro-spec is an elaborate testing library that builds on top of
clojure.test
.Fulcro-spec has its own organizational structure for tests, and has custom
clojure.test
events that correspond with them, like:begin-specification
or:end-provided
. It's intended to be used with its own reporter that knows how to handle these events.The Issue
When Kaocha sees an event type it doesn't know about, it forwards it to the original
clojure.test/report
(so ignoring rebinding). If nodefmethod
's exist for these types thenclojure.test/report
just prints out the event map, and since the:kaocha/testable
is in there this gets really noisy.Why is it like that
In this case fulcro-spec provides both custom events and a custom reporter, expecting you to rebind
clojure.test/report
. Other libraries (e.g. assertion libraries) provide custom events but no custom reporter, instead extending theclojure.test/report
method to handle these events. Both approaches are within scope of the intended use ofclojure.test
, but they are not compatible.So Kaocha rebinds the reporter, but still forwards unknown events to the original reporter, assuming they will be handled on that level.
Possible solutions
As a first step we should check if
clojure.test/report
has a multimethod implementation for a given event type before forwarding the event. The default behavior of printing the event map is never useful.Note that this could also be solved presently by adding the fulcro-spec events type to the kaocha hierarchy, making kaocha aware of them and thus preventing the forwarding.
Kaocha reporters and general compatibility
I'll have to try out fulcro-spec to better understand what its reporter is bringing to the table, and how well it plays with other libraries. E.g. I suspect that you can't use matcher-combinators with fulcro-spec's reporter.
Going forward we should make sure fulcro-spec can also work with Kaocha's reporters, since these provide facilities for extension by multiple parties, preventing some of the problems that extending
clojure.test/report
directly has.