testing

Testing tools, testing philosophy & methodology...
Yehonathan Sharvit 2016-06-27T15:04:13.000005Z

I’d like to test a javascript library

Yehonathan Sharvit 2016-06-27T15:04:24.000006Z

I did it with lein doo

Yehonathan Sharvit 2016-06-27T15:05:21.000007Z

with the following project.clj

Yehonathan Sharvit 2016-06-27T15:05:25.000008Z

`

Yehonathan Sharvit 2016-06-27T15:05:33.000009Z

clojure
(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"]
                 [org.clojure/test.check "0.9.0"]] 
  :clean-targets ^{:protect false} ["resources/public/fig/js"]
  :plugins [[lein-doo "0.1.6"]
            [lein-figwheel "0.5.4-3"]]
  :source-paths ["src"]
  :figwheel {:server-port 5018}
  :cljsbuild {:builds
              {:test
               {:source-paths ["src" "resources/public/js"]
                :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"}}
               :figwheel
               {:figwheel true
                :source-paths ["src"]
                :compiler
                {:main "js-test-in-cljs.test.runner"
                 :preamble "js/main.js"
                 :asset-path "fig/js"
                 :output-to "resources/public/fig/js/my.fig.js"
                 :output-dir "resources/public/fig/js"}}}})

Yehonathan Sharvit 2016-06-27T15:06:21.000013Z

I used the :preamble options to load the javascript file

Yehonathan Sharvit 2016-06-27T15:06:41.000014Z

The problem is that :preamble is not supported with :optimizations :none

Yehonathan Sharvit 2016-06-27T15:06:59.000015Z

And :optimizations :simple is a bit slow

Yehonathan Sharvit 2016-06-27T15:07:11.000016Z

Any idea how to solve that?