This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-01-23
Channels
- # aleph (1)
- # architecture (4)
- # aws (7)
- # beginners (249)
- # boot (17)
- # calva (4)
- # cider (30)
- # cljdoc (7)
- # cljs-dev (1)
- # cljs-experience (3)
- # clojure (69)
- # clojure-dev (7)
- # clojure-europe (1)
- # clojure-italy (7)
- # clojure-japan (15)
- # clojure-spec (6)
- # clojure-uk (39)
- # clojurescript (51)
- # cursive (31)
- # data-science (4)
- # datavis (1)
- # datomic (40)
- # dirac (67)
- # duct (8)
- # editors (15)
- # emacs (9)
- # events (3)
- # figwheel-main (2)
- # fulcro (157)
- # juxt (4)
- # kaocha (11)
- # lein-figwheel (1)
- # off-topic (31)
- # pathom (18)
- # re-frame (4)
- # reagent (2)
- # reitit (16)
- # remote-jobs (1)
- # shadow-cljs (11)
- # specter (2)
- # speculative (1)
- # tools-deps (27)
- # vim (1)
- # yada (2)
can you elaborate a bit @stathissideris?
@plexus I have a bunch of spec s/fdefs on my functions, and I’d like to instrument those functions with their specs before running my tests
the hooks plugin is your friend, probably a post-load hook makes sense so you know everything's been loaded/defined
(ns my.app.kaocha-hooks)
(defn post-load [test-plan]
(clojure.spec.test.alpha/instrument)
test-plan)
#kaocha/v1
{:plugins [:kaocha.plugin/hooks]
:kaocha.hooks/post-load [my.app.kaocha-hooks/post-load]}
watch out that you return test-plan
from the hook function (this is true of all hooks, always return the first argument)
Thanks for this. Just seconding that I have this same usecase too, and I suspect it will become increasingly common. Might it be worth adding something like this to the manual?
Incidentally how might this work if your app uses something like integrant and ig/load-namespaces
.
i.e. you have a constructor function in the app that loads the apps namespaces and specs dynamically, rather than using the require tree?
Thank you very much, I’ll try it out!
I'm trying to use kaocha with shadow-cljs, is there a way to get it to recognize installed node modules? I know shadow-cljs does some non-standard things with require; I'm doing (:require ["algebra.js" :as algebra])
and getting No such namespace: algebra.js, could not locate algebra/js.cljs, algebra/js.cljc, or JavaScript source providing "algebra.js" in file /my/project/utils/algebra.cljs