jeudi 24 septembre 2015

clojurescript unit testing recommendations

Trying to setup basic unit testing with clojurescript. Looked at:

http://ift.tt/1jf5OUj

In my project.clj file I have:

:cljsbuild {
            :builds [{:id "dev"
                      :source-paths ["src" "test"]
                      :figwheel { :on-jsload "http://ift.tt/1KCcKke" }
                      :compiler {:main figreag.router
                                 :asset-path "js/compiled/out"
                                 :output-to "resources/public/js/compiled/my_proj.js"
                                 :output-dir "resources/public/js/compiled/out"
                                 :source-map-timestamp true }}

The main point is I add "test" into the :source-paths.

Then in: test/my-proj/tests.cljs I have:

(ns  ^:figwheel-always my-proj.tests
(deftest all-tests
  (run-tests 'my-proj.core-test)
  (run-tests 'my-proj.util-test))

Then in my REPL I do (run-tests). Is this the idiomatic way? I am also using figwheel too, obviously.

Aucun commentaire:

Enregistrer un commentaire