kaocha

Official support channel: https://clojureverse.org/c/projects/kaocha
plexus 2020-06-11T08:18:26.292400Z

ERROR: Error in reporter probably means it's a Kaocha bug. Congratulations! šŸ™‚

plexus 2020-06-11T08:24:14.294400Z

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 vector

plexus 2020-06-11T08:26:22.294900Z

asking questions here is fine btw, it's what everyone does šŸ™‚

avi 2020-06-11T13:25:38.295100Z

Thanks Arne!

avi 2020-06-11T13:26:32.296100Z

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ā€¦

avi 2020-06-11T13:28:06.296700Z

Ah, Iā€™ve already fixed the bug in my code so I need to backtrack to find the commit that caused the problemā€¦ šŸ˜…

plexus 2020-06-11T18:23:03.298600Z

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

avi 2020-06-11T18:23:35.299100Z

Ahā€¦ okā€¦ soā€¦ do I report a bug somewhere?

avi 2020-06-11T18:24:14.299800Z

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 ?

plexus 2020-06-11T18:26:06.301800Z

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.

plexus 2020-06-11T18:26:36.302600Z

Actually it's perhaps a little more involved, you'd have to make sure the equality check doesn't throw, but the printing does...

plexus 2020-06-11T18:26:48.303Z

It's a pretty niche edge case :)

avi 2020-06-11T18:27:14.303300Z

šŸ˜“

plexus 2020-06-11T18:28:00.304400Z

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

avi 2020-06-11T18:28:11.304600Z

ok, thank you!

plexus 2020-06-11T18:30:43.306800Z

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]))

plexus 2020-06-11T18:31:43.308100Z

The equality check should just return false because it short circuits after comparing the first element, but printing would throw

plexus 2020-06-11T19:21:08.309300Z

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...

plexus 2020-06-11T19:22:20.310Z

Is that snippet you shared at the beginning really the full output you're getting from (dad.db.export-test/split-record)?

avi 2020-06-11T19:30:23.310400Z

I believe it was; Iā€™ll have to back-track and try to reproduce it

avi 2020-06-11T19:31:07.310800Z

This is the branch Iā€™m working on right now šŸ˜…

avi 2020-06-11T19:31:09.310900Z

avi 2020-06-11T19:31:32.311500Z

(every single commit message is just WIP++ šŸ˜¬)

rgm 2020-06-11T23:12:08.312600Z

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.

rgm 2020-06-11T23:13:13.314300Z

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.

rgm 2020-06-11T23:13:47.315200Z

(The full suite happens before deploy; this happens to speed up PR merging).