From 08f7084d920755d3654cd95917bc3415a4f239f1 Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Tue, 5 Jul 2016 18:55:55 -0700 Subject: [PATCH] Add lein-doo to run ClojureScript tests. --- README.md | 4 +++ project.clj | 64 +++++++++++++++++++++--------------- test/datomish/test.cljs | 7 ++++ test/datomish/test/core.cljs | 7 ++++ 4 files changed, 55 insertions(+), 27 deletions(-) create mode 100644 test/datomish/test.cljs create mode 100644 test/datomish/test/core.cljs diff --git a/README.md b/README.md index caeaad96..97b7ba2c 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,10 @@ Now you can use `:Eval`, `cqc`, and friends to evaluate code. Fireplace should c :Connect nrepl://localhost:62385 ``` +## To run the ClojureScript tests + +Run `lein doo node test once`, or `lein doo node` to re-run on file changes. + ### Preparing an NPM release The intention is that the `release-js/` directory is roughly the shape of an npm-ready JavaScript package. diff --git a/project.clj b/project.clj index 7d1d0fc0..00e21ef4 100644 --- a/project.clj +++ b/project.clj @@ -2,40 +2,50 @@ :description "A persistent, embedded knowledge base inspired by Datomic and DataScript." :url "https://github.com/mozilla/datomish" :license {:name "Mozilla Public License Version 2.0" - :url "https://github.com/mozilla/datomish/blob/master/LICENSE"} + :url "https://github.com/mozilla/datomish/blob/master/LICENSE"} :dependencies [[org.clojure/clojurescript "1.9.89"] [org.clojure/clojure "1.8.0"]] - :cljsbuild {:builds [{:id "release" - :source-paths ["src"] - :assert false - :compiler {:output-to "release-js/datomish.bare.js" - :optimizations :advanced - :pretty-print false - :elide-asserts true - :output-wrapper false - :parallel-build true} - :notify-command ["release-js/wrap_bare.sh"]} - ]} + :cljsbuild {:builds {:release { + :source-paths ["src"] + :assert false + :compiler {:output-to "release-js/datomish.bare.js" + :optimizations :advanced + :pretty-print false + :elide-asserts true + :output-wrapper false + :parallel-build true} + :notify-command ["release-js/wrap_bare.sh"]} + :advanced {:source-paths ["src"] + :compiler {:output-to "target/advanced/datomish.js" + :optimizations :advanced + :source-map "target/advanced/datomish.js.map" + :pretty-print true + :recompile-dependents false + :parallel-build true + }} + :test { + :source-paths ["src" "test"] + :compiler {:output-to "target/test/datomish.js" + :output-dir "target/test" + :main datomish.test + :optimizations :none + :source-map true + :recompile-dependents false + :parallel-build true + :target :nodejs + }} + } + } :profiles {:dev {:dependencies [[com.cemerick/piggieback "0.2.1"] [org.clojure/tools.nrepl "0.2.10"]] :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]} - :source-paths [] - :plugins [[lein-cljsbuild "1.1.2"]] - :cljsbuild {:builds [{:id "advanced" - :source-paths ["src"] - :compiler { - :output-to "target/datomish.js" - :optimizations :advanced - :source-map "target/datomish.js.map" - :pretty-print true - :recompile-dependents false - :parallel-build true - }} - ]} - } - } + :plugins [[lein-cljsbuild "1.1.2"] + [lein-doo "0.1.6"]] + }} + + :doo {:build "test"} :clean-targets ^{:protect false} ["target" "release-js/datomish.bare.js" diff --git a/test/datomish/test.cljs b/test/datomish/test.cljs new file mode 100644 index 00000000..6be8e642 --- /dev/null +++ b/test/datomish/test.cljs @@ -0,0 +1,7 @@ +(ns datomish.test + (:require + [doo.runner :refer-macros [doo-tests]] + [cljs.test :as t :refer-macros [is are deftest testing]] + datomish.test.core)) + +(doo-tests 'datomish.test.core) diff --git a/test/datomish/test/core.cljs b/test/datomish/test/core.cljs new file mode 100644 index 00000000..a67f2ecf --- /dev/null +++ b/test/datomish/test/core.cljs @@ -0,0 +1,7 @@ +(ns datomish.test.core + (:require + [cljs.test :as t :refer-macros [is are deftest testing]] + [datomish.core :as d])) + +(deftest test-core + (is (= 1 1)))