lambdaisland / kaocha-cljs

ClojureScript support for Kaocha
Eclipse Public License 1.0
40 stars 10 forks source link

Error when Clojurescript is earlier than 1.10 #33

Closed alysbrooks closed 3 years ago

alysbrooks commented 3 years ago

If you have the wrong version of Clojurescript, you may get unclear errors upon trying to run Kaocha, so it's best to check the version upfront and warn the user.

This is the kaocha-cljs version of Throw error when on a version of Clojure prior to 1.9.. I'm not sure this is the exactly the right approach, as I'm less familiar with this plugin. In particular, I'm wondering whether we want to error out on the Clojure side of this plugin, too.

plexus commented 3 years ago

I think we should do this on the Clojure side. If people use an incompatible version of ClojureScript, then we may never get to the point where this code is compiled and running, so the error would never show up.

Instead in the -load implementation for a cljs test suite we can see which clojurescript version is available, and return a testable with a load error if it's too low.

(defmethod ... [testable]
  (if ...cljs-version-too-low...
     (assoc testable :kaocha.testable/load-error (ex-info "ClojureScript version too low" {:expected "1.10" :got "..."})
     ...run normally...))

The kaocha machinery should do the rest.

alysbrooks commented 3 years ago

Doing it in -load may be too late. I keep getting a "No such var: repl/repl-options" even though, as far as I can tell, Clojurescript 1.9 had repl-options.

plexus commented 3 years ago

Looks good I think!

plexus commented 3 years ago

singin-dancin