From 4695c9699879c2dd6def787dd167f8c3a370e9f2 Mon Sep 17 00:00:00 2001 From: Mayank Jain Date: Sat, 11 Mar 2017 01:24:45 +0530 Subject: [PATCH] Add cljs tests to travis * Add lein-doo plugin to run cljs tests. This is the new recommended approach. * Update project.clj to add cljsbuild config * Update .travis.yml file to run cljs tests as well. * Also to speed up travis builds add ~/.m2 dir in cache To run do: $ lein do javac, doo phantom test-build once Note that you'll need phantomjs installed for above to work. --- .travis.yml | 5 +++++ project.clj | 9 ++++++++- test/com/rpl/specter/cljs_test_runner.cljs | 7 +++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3c0f2e5..0104ee0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,8 @@ language: clojure +lein: 2.7.1 +cache: + directories: + - $HOME/.m2 script: - lein test + - lein doo phantom test-build once diff --git a/project.clj b/project.clj index 8db8e6e..ba4780d 100644 --- a/project.clj +++ b/project.clj @@ -9,7 +9,8 @@ :test-paths ["test", "target/test-classes"] :auto-clean false :dependencies [[riddley "0.1.12"]] - :plugins [[lein-codox "0.9.5"]] + :plugins [[lein-codox "0.9.5"] + [lein-doo "0.1.7"]] :codox {:source-paths ["target/classes" "src/clj"] :namespaces [com.rpl.specter com.rpl.specter.zipper @@ -20,6 +21,12 @@ #".*" "https://github.com/nathanmarz/specter/tree/{version}/src/clj/{classpath}#L{line}"}} + :cljsbuild {:builds [{:id "test-build" + :source-paths ["src/clj" "target/classes" "test"] + :compiler {:output-to "out/testable.js" + :main 'com.rpl.specter.cljs-test-runner + :optimizations :simple}}]} + :profiles {:dev {:dependencies [[org.clojure/test.check "0.9.0"] [org.clojure/clojure "1.8.0"] diff --git a/test/com/rpl/specter/cljs_test_runner.cljs b/test/com/rpl/specter/cljs_test_runner.cljs index fd8e55a..49c06c2 100644 --- a/test/com/rpl/specter/cljs_test_runner.cljs +++ b/test/com/rpl/specter/cljs_test_runner.cljs @@ -1,8 +1,7 @@ (ns com.rpl.specter.cljs-test-runner - (:require [cljs.test :as test :refer-macros [run-tests]] + (:require [doo.runner :refer-macros [doo-tests]] [com.rpl.specter.core-test] [com.rpl.specter.zipper-test])) - -(run-tests 'com.rpl.specter.core-test) -(run-tests 'com.rpl.specter.zipper-test) +(doo-tests 'com.rpl.specter.core-test + 'com.rpl.specter.zipper-test)