This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-11
Channels
- # announcements (4)
- # aws (6)
- # babashka (40)
- # beginners (318)
- # biff (4)
- # bootstrapped-cljs (9)
- # calva (19)
- # chlorine-clover (1)
- # cider (3)
- # clj-on-windows (25)
- # cljdoc (8)
- # cljfx (1)
- # cljs-dev (30)
- # cljss (2)
- # clojure (62)
- # clojure-chile (9)
- # clojure-europe (11)
- # clojure-finland (17)
- # clojure-italy (1)
- # clojure-kc (1)
- # clojure-nl (3)
- # clojure-spec (27)
- # clojure-uk (40)
- # clojuremn (1)
- # clojurescript (51)
- # conjure (6)
- # cursive (8)
- # data-science (9)
- # datahike (4)
- # datascript (1)
- # datomic (31)
- # emacs (10)
- # emotion-cljs (1)
- # events (1)
- # figwheel-main (16)
- # find-my-lib (1)
- # fulcro (30)
- # graalvm (3)
- # graphql (12)
- # helix (16)
- # honeysql (5)
- # jobs (1)
- # jobs-discuss (10)
- # juxt (3)
- # kaocha (26)
- # lambdaisland (3)
- # leiningen (15)
- # malli (7)
- # off-topic (100)
- # pathom (8)
- # pedestal (15)
- # protojure (24)
- # re-frame (2)
- # reagent (7)
- # reitit (22)
- # remote-jobs (1)
- # shadow-cljs (140)
- # spacemacs (17)
- # spire (2)
- # tools-deps (23)
- # uix (11)
- # vim (5)
- # xtdb (3)
- # yada (3)
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 vectorIf 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
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...
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
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)
?
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.