lambdaisland / kaocha-cljs

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

Issues using CLJSJS #3

Closed plexus closed 5 years ago

plexus commented 5 years ago

This was reported on Slack:

I have a dependency to moment in my deps.edn:

cljsjs/moment                  {:mvn/version "2.22.2-2"}

but when I run:

clojure -A:test-cljs -m kaocha.runner unit-cljs

I get:

Exception in thread "main" clojure.lang.ExceptionInfo: No such namespace: moment, could not locate moment.cljs, moment.cljc, or JavaScript source providing "moment" in file ...

CLJSJS packages contain specific :foreign-libs entries that automatically get added to the compiler options, I'm guessing these aren't currently being picked up properly.

rgm commented 5 years ago

Just in case anyone else stumbles across this, I worked around a similar issue by just supplying :cljs/compiler-options directly in my tests.edn, eg:

{:id :cljs/unit
          :type :kaocha.type/cljs
          :test-paths ["test"]
          :source-paths ["src"]
          :cljs/compiler-options {:foreign-libs
                                  [{:file "target/public/js-out/react.min.js"
                                    :provides ["react"]
                                    :global-exports {react React}}]}}

My situation isn't exactly a cljsjs one, but it's similar.

In my case I've been using the ClojureScript with Webpack guide to manually trim down my foreign libs (since they're just being concatenated and not participating in dead-code removal) and I used the same :foreign-libs stanza I've been supplying to Figwheel.

plexus commented 5 years ago

This is fixed now in 0.0-21