fulcrologic / fulcro-spec

A library that wraps clojure.test for a better BDD testing experience.
MIT License
43 stars 6 forks source link

clojure.test.check fails together with fulcro-spec #5

Closed mitchelkuijpers closed 6 years ago

mitchelkuijpers commented 7 years ago

When I try to use the fulcro-spec server stuff to run them in the browser, I used to get weird errors which would say Could not find cloure.test.check.clojure-test after some digging around I found the followin exception (which explains the error above).

17-08-25 13:27:30 mitsel ERROR [fulcro.server:276] - #:fulcro-spec.selectors{set-active-selectors #:om.next{:error java.lang.ClassCastException: fulcro_spec.reporter$fulcro_report$fn__66506 cannot be cast to clojure.lang.MultiFn, compiling:(clojure/test/check/clojure_test.cljc:119:1)}} Parser error:
 {:status 400,
 :body
 #:fulcro-spec.selectors{set-active-selectors
                         #:om.next{:error
                                   {:type
                                    "class clojure.lang.Compiler$CompilerException",
                                    :message
                                    "java.lang.ClassCastException: fulcro_spec.reporter$fulcro_report$fn__66506 cannot be cast to clojure.lang.MultiFn, compiling:(clojure/test/check/clojure_test.cljc:119:1)"}}}}

I found this code in clojure.test.check

(let [begin-test-var-method (get-method ct/report #?(:clj  :begin-test-var
                                                     :cljs [::ct/default :begin-test-var]))]
  (defmethod ct/report #?(:clj  :begin-test-var
                          :cljs [::ct/default :begin-test-var]) [m]
    (reset! last-trial-report (get-current-time-millis))
    (when begin-test-var-method (begin-test-var-method m))))

It seems to expect a multimethod. Would you accept a pull request that fixes this?

awkay commented 7 years ago

Of course.

awkay commented 6 years ago

This is fixed...