This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-19
Channels
- # beginners (7)
- # boot (48)
- # clojure (50)
- # clojure-portugal (1)
- # clojure-russia (10)
- # clojure-spec (29)
- # clojure-uk (9)
- # clojurescript (116)
- # core-logic (1)
- # cursive (12)
- # datascript (2)
- # datomic (7)
- # defnpodcast (8)
- # dirac (80)
- # emacs (486)
- # hoplon (5)
- # instaparse (3)
- # keechma (1)
- # luminus (3)
- # lumo (35)
- # off-topic (65)
- # om (6)
- # onyx (6)
- # perun (42)
- # re-frame (5)
- # reagent (5)
- # rum (2)
- # untangled (170)
- # vim (13)
Is there a way to instrument by default while in dev environment?
@viebel I think you could pull that off with leiningen profiles; not sure how that would interact with code reloading though
Is there an established standard to run spec tests (`stest/check`) from a clojure.test
suite (e.g. on lein test
)?
@nblumoe not a standard, but I would probably reach for test.check's defspec
: https://github.com/clojure/test.check#clojuretest-integration
Call that and use (s/gen ::my-spec)
to get the gen to us in prop/for-all
If it's just the builtin spec tests, then just using deftest and wrapping the stest/check call in an assertion might make more sense
defspec would be more useful for custom assertions/tests
@gfredericks something like (deftest specs (is (stest/check)))
would not be sufficient as it seems, what would you check for?
Examine the return value. Is there a result
key?
This might help
It’s for cljs but not too hard to adapt to clojure
thx. If I understand correctly all three solutions require looking at the :failure
key manually / with a helper. Okay then I will do that too. Was hoping for a generic integration into clojure.test
ok works from the REPL and via Cider, but not with lein test
. Any ideas? Here is the error (I don’t get it so far tbh):
ERROR in (foo) (FutureTask.java:122)
foo
expected: (nil? (-> spec-check first :failure))
actual: java.util.concurrent.ExecutionException: java.lang.ClassCastException: clojure.lang.AFunction$1 cannot be cast to clojure.lang.MultiFn, compiling:(clojure/test/check/clojure_test.cljc:95:1)
at java.util.concurrent.FutureTask.report (FutureTask.java:122)
java.util.concurrent.FutureTask.get (FutureTask.java:192)
clojure.core$deref_future.invokeStatic (core.clj:2290)
clojure.core$future_call$reify__9377.deref (core.clj:6849)
clojure.core$deref.invokeStatic (core.clj:2310)
clojure.core$deref.invoke (core.clj:2296)
clojure.core$map$fn__6881.invoke (core.clj:2728)
clojure.lang.LazySeq.sval (LazySeq.java:40)
clojure.lang.LazySeq.seq (LazySeq.java:56)
clojure.lang.LazySeq.first (LazySeq.java:71)
clojure.lang.RT.first (RT.java:682)
clojure.core$first__6404.invokeStatic (core.clj:55)
clojure.core/first (core.clj:55)
geomix.calc.pva_test$check_SINGLEQUOTE_.invokeStatic (pva_test.clj:244)
this happens whenever I call some function with (stest/check
my-fn)` as an argument within a deftest
body....
You're running into the lein test monkey patch problem
There are tickets in both lein and test.check about it, but you can work around it by turning it off in project.clj
What is the flag that needs to be set in order to instrument all the namespaces (while in dev environment)?
There is no such flag
@alexmiller I guess that would be monkeypatch-clojure-test
https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L351 ?
@viebel you can call instrument with no args though
Where would I put this call?
Is there a dynamic var that I could set from leiningen like *assert*
?
@viebel I do a classic when
at the top of my files to instrument everything, I haven't seen anything fancier