On 02/15/2014 07:00 AM, Chas Emerick wrote:
On 02/14/2014 05:26 PM, Joel Holdbrooks wrote:
On Friday, February 14, 2014 12:54:41 PM UTC-8, Chris Zheng wrote:
Is there a way of doing autotesting of clojurescript code?
I'm using 0.2.2 and when I run lein cljsbuild test, it only seems to
test once.
My settings are:
:cljsbuild {:builds [{:source-paths ["src" "test"]
:compiler {:output-to "target/cljs/testable.js"
:optimizations :whitespace
:pretty-print true}}]
:test-commands {"unit-tests" ["phantomjs" :runner
"this.literal_js_was_evaluated=true"
"target/cljs/testable.js"]}}
Forgot the link, whoops! Here it is:
http://noprompt.github.io/clojurescript/testing/ruby/2014/01/25/autotesting-clojurescript.html
You don't need external tools for this kind of workflow;
lein-cljsbuild provides a :notify-command option that will shell out
to whatever you want (including a phantomjs/node/whatever process to
run your tests):
https://github.com/emezeske/lein-cljsbuild/blob/master/sample.project.clj#L73
I was reminded of this via
https://github.com/cemerick/clojurescript.test/issues/26 (which is re:
the fact that :runner, :node-runner, etc are currently only replaced
within :test-commands). I'll get that into clojurescript.test right
after 0.3.0 (async support) is done.
- Chas
OK, so I decided to bring a fix for clojurescript.test issue #26 into
v0.2.3 straight away. So, using [com.cemerick/clojurescript.test
"0.2.3-SNAPSHOT"], you can put references to your desired test runners
anywhere in the project map (including :notify-command lein-cljsbuild
command vectors), so you can trigger tests on `cljsbuild auto` builds
easily. The one wrinkle is that I decided that swapping out
unnamespaced keywords throughout the project map was a bit impolite, so
*outside of `:test-commands`, you need to namespace test runner keyword
placeholders*, like so:
:notify-command ["phantomjs" :cljs.test/runner "target/cljs/testable.js"]
...and so on.
Cheers,
- Chas
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups "ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.