test.check
is not bundled with Lumo
no plans to bundle it either
maybe there are plans to make spec not depend on test.check
, as far as I see, cljs.spec.test/instrumentation should be highly encouraged to be used.
I'm casting my mind quite far back here, but I seem to recall the dependency being optional.
Unless you wanted to use feature X
cljs.spec.test.alpha/instrument
needs clojure.test.check, strangely.
or the whole spec.test, like I wrote above.
Yes, that is a ClojureScript requirement....
why no plans to bundle it?
I've also resisted bundling it with Planck—it is not part of ClojureScript proper and it has its own independent release cycle.
As a counter argument, where do you stop? Should Andare be bundled, etc.?
One place that I've made an exception is for Replete, where you have no choice. (It also seems to fit with the app's name, having it bundle lots of libs 🙂 )
@hlolli The reason you need test.check
for instrument
is perhaps best explained with a concrete example. But the general idea is that it needs to generate values to pass to speced higher order functions. Example:
cljs.user=> (require '[clojure.spec.alpha :as s])
nil
cljs.user=> (s/def ::foo (s/fspec :args (s/cat :x int? :y string?)))
:cljs.user/foo
cljs.user=> (defn some-foo [x y] (prn x y))
#'cljs.user/some-foo
cljs.user=> (defn bar [foo z] (prn z))
#'cljs.user/bar
cljs.user=> (s/fdef bar :args (s/cat :foo ::foo :z int?))
cljs.user/bar
cljs.user=> (require '[clojure.spec.test.alpha :as st])
nil
cljs.user=> (st/instrument)
[cljs.user/bar]
cljs.user=> (bar some-foo 3)
0 ""
-1 ""
0 "7"
1 "iet"
0 "P"
6 "T33"
3 "L"
-6 "fu775"
0 "2v9K655S"
-118 "7G3"
-2 "52q"
-51 "6f37zW351"
5 "934"
-4046 "087Fd"
0 "94Y3oMjl"
-1 "0e02j0kH3o45"
-323 "A8saPQ74W7kv5u6"
29 "T6fZD973dfJ"
189 "30ZBgZ27Xn"
5056 ""
-794 "bJf9MRNBtZBCxW5rN7p"
3
nil
Surprised and confused about how instrument works. I thought the goal was to alert the user that he provided arguments in runtime that defy the spec.
If this surprises you, it did me as well, and Alex gave some insight https://clojurians-log.clojureverse.org/clojure-spec/2017-06-06.html