ERROR: Error in reporter
probably means it's a Kaocha bug. Congratulations! š
hmmm having a better look at your stack trace maybe it's not a Kaocha bug, I think this line is clojure.test
is involved
(println " actual:" (pr-str (:actual m)))))
The printing is causing a lazy seq to be realized, which ends up calling into your code again (`dad.db.export/split-record` -> dad.db.export/add-fk
), and there you are doing an (assoc m k v)
where you are expecting m
to be a map, but it's actually a vectorasking questions here is fine btw, it's what everyone does š
Thanks Arne!
If itās a bug in clojure.test
then why donāt I see something similar when I run the test var directly? Ah, maybe itās something in the clojure.test
āfind-and-run-some-testsā facility? Iāll try thatā¦
Ah, Iāve already fixed the bug in my code so I need to backtrack to find the commit that caused the problemā¦ š
The Clojure test reporting is definitely strange because you're only getting the "expected" part. There should be a line after that starting with "Actual:". If that's not there then my guess is clojure.test is swallowing the exception
Ahā¦ okā¦ soā¦ do I report a bug somewhere?
Iām a little fuzzy on how to report bugs in Clojure right nowā¦ I know feature requests go to the āaskā site. Maybe I should post the problem to #testing ?
See if you can make a minimal reproduction. If my guess is correct then creating a lazy-seq
that throws and using that in the first position of (is (=)) should be enough. I can try it out tomorrow as well.
Actually it's perhaps a little more involved, you'd have to make sure the equality check doesn't throw, but the printing does...
It's a pretty niche edge case :)
š
I'll test it out when I get a chance. I may be widely off with my speculation but it's the only theory I have that would explain what you're seeing
ok, thank you!
Not at a computer now so I can't try it out but it would look something like this (is (= [0 (lazy-seq (throw (Exception.)))] [1]))
The equality check should just return false because it short circuits after comparing the first element, but printing would throw
user> (deftest foo-test (is (= [0 (lazy-seq (throw (java.lang.IllegalArgumentException.)))] [1])))
#'user/foo-test
user> (foo-test)
FAIL in (foo-test) (NO_SOURCE_FILE:187)
expected: (= [0 (lazy-seq (throw (java.lang.IllegalArgumentException.)))] [1])
ERROR in (foo-test) (NO_SOURCE_FILE:187)
expected: (= [0 (lazy-seq (throw (java.lang.IllegalArgumentException.)))] [1])
actual: java.lang.IllegalArgumentException: null
at user$fn__15257$fn__15258.invoke (NO_SOURCE_FILE:187)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:51)
I'm not immediately able to reproduce the problem you're seeing...Is that snippet you shared at the beginning really the full output you're getting from (dad.db.export-test/split-record)
?
I believe it was; Iāll have to back-track and try to reproduce it
This is the branch Iām working on right now š
(every single commit message is just WIP++
š¬)
Wonder if this is more tractable in Clojure than Ruby: https://engineering.shopify.com/blogs/engineering/spark-joy-by-running-fewer-tests ... be a neat add-on for Kaocha.
TL;DR: theyāre making up a call graph for every test, and when your code changes any call in the graph, that gets used to figure out which tests should run.
(The full suite happens before deploy; this happens to speed up PR merging).