This library is a subset of clojure.test
for Clojure and ClojureScript. It
lets you write tests (albeit with constraints) that can run on both Clojure and
ClojureScript.
You can also use this library to write JVM-specific and CLJS-specific tests.
For ClojureScript testing this library should be used in conjunction with lein-cljsbuild.
On Clojars: On Clojars: https://clojars.org/clip-test
Leiningen dependency: [clip-test "0.2.1"]
Supported Clojure versions: 1.2, 1.3, 1.4, 1.5
Tested with lein-cljsbuild version: 0.2.9
- Only
deftest
,testing
andis
macros are supported. thrown?
andthrown-with-msg?
are implemented as macros; unlikeclojure.test
, there is no multi-method to extend the dispatch on.- You must implement the
test-ns-hook
function in the test namespace and call it externally to run the tests in CLJS. - Write the tests in the same style as in
test/clip_test/core_test.clj
. - Invoke the tests in CLJS in a way similar as in
run-tests.js
/run-tests.html
andtest-cljs/clip_test/run_tests.cljs
. - You need to have PhantomJS (
run-tests.js
) and/or Firefox+Firebug (run-tests.html
) or any browser supporting JavaScript console to run the tests in CLJS. - The namespaces
clip-test.testutil
andclip-test.testutil-cljs
have common functions that provide similar functionality in Clojure and ClojureScript.
The following projects use clip-test for CLJS testing:
Clean old stuff if required (esp for ClojureScript testing):
lein clean
lein dev cljsbuild clean
Run the tests (you may see failures and errors - they are expected):
lein dev test # test with latest stable Clojure version
lein dev cljsbuild test # test with ClojureScript (needs `phantomjs` installed)
lein all test # test with all supported Clojure versions
Clean old stuff if required (see 'Running tests' section above.) Then run this:
lein jar # create the JAR file
lein install # install JAR to local Maven repo
On Twitter: @kumarshantanu
E-mail: kumar(dot)shantanu at gmail.com
Copyright © 2012 Shantanu Kumar
Distributed under the Eclipse Public License, the same as Clojure.