@mfikes Shortest path to reproduction:
$ plk -A:test:repl
cljs.user=> (stest/instrument [`=])
[cljs.core/=]
cljs.user=> (= [1 1] ::s/invalid)
Call to #'cljs.core/= did not conform to spec:
In: [1] val: :cljs.spec.alpha/invalid fails at: [:args] predicate: any?
:cljs.spec.alpha/spec #object[cljs.spec.alpha.t_cljs$spec$alpha5193]
:cljs.spec.alpha/value ([1 1] :cljs.spec.alpha/invalid)
:cljs.spec.alpha/args ([1 1] :cljs.spec.alpha/invalid)
:cljs.spec.alpha/failure :instrument
cljs.core/ExceptionInfo (cljs/core.cljs:11129:11)
cljs.spec.test.alpha/c (cljs/spec/test/alpha.cljs:117:57)
cljs.spec.test.alpha/d (cljs/spec/test/alpha.cljs:114:29)
cljs.core/d (cljs/core.cljs:2008:6)
cljs.core/a (cljs/core.cljs:2045:15)
Now I can repoduce this on clj + cljs:
(defn foo [& args])
(s/fdef foo :args (s/* any?))
(stest/instrument [`foo])
(foo 1 2 3) ;; fine
(foo 1 2 ::s/invalid) ;; error
working on a fix
Iām a bit stuck on with-unstrumentation
in cljs. it does work properly in clj
:
https://github.com/slipset/speculative/blob/master/test/speculative/core_test.cljc#L30
with-instrumentation and with-unstrumentation should now restore their previous instrumented state
reason for this extra unstrumentation macro: having =
instrumented while check
-ing it, causes a spec error in cljs
fixed
sorry for the noise š
would it be ok to move some of test-utils to a speculative.spec.test namespace, so I could use it in other projects as well? it relies on some of the spec.test.alpha internals, but our library is called speculative for a reason right? š
Go ahead!
done
doc: https://github.com/slipset/speculative#test-tools puzzle for @mfikes https://github.com/slipset/speculative/blob/master/test/speculative/test_test.cljc#L51 š
I also added a :repl
alias for easy debugging
E.g.:
$ plk -A:test:repl
cljs.user=> (with-instrumentation `= (=))
^
WARNING: Wrong number of args (0) passed to cljs.core/= at line 1
Call to #'cljs.core/= did not conform to spec: