bensu / doo

doo is a library and lein plugin to run cljs.test on different js environments.
Eclipse Public License 1.0
324 stars 63 forks source link

Testing javascscript code with `doo` #111

Closed viebel closed 8 years ago

viebel commented 8 years ago

I'd like to test javascript code with doo.

The trick I thought about was to include the javascript file as a :preamble. Like this:

(defproject js-test-in-cljs "0.0.1"
  :description "Test Javascript code in clojurescript"
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [org.clojure/clojurescript "1.9.36"]] 
  :plugins [[lein-doo "0.1.6"]]
  :source-paths ["src"]
  :cljsbuild {:builds
              {:test
               {:source-paths ["src"]
                :compiler
                {:main "js-test-in-cljs.test.runner"
                 :preamble ["main.js"]
                 :optimizations :simple
                 :output-to "resources/public/test/js/testable.js"
                 :output-dir "resources/public/test/js"}}}}})

The problem is that :preamble is not supported in :optimizations :none. And it cause the auto build of lein doo to be a bit slow (around 7 seconds).

Is there a better way to include javscript file with doo?

bensu commented 8 years ago

Hi @viebel ,

Can you check if using :foreign-libs as explained in #25 solves your issue?

viebel commented 8 years ago

It works like a charm!

bensu commented 8 years ago

Great! I should document this then (#112)