Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A subset of `clojure.test` for Clojure and ClojureScript

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 doc
Octocat-spinner-32 src
Octocat-spinner-32 test-cljs
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 CHANGES.md
Octocat-spinner-32 README.md
Octocat-spinner-32 project.clj
Octocat-spinner-32 run-tests.html
Octocat-spinner-32 run-tests.js
README.md

clip-test

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.

Usage

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.2"]

Supported Clojure versions: 1.2, 1.3, 1.4, 1.5

Tested with lein-cljsbuild version: 0.2.9

Notes:

  • Only deftest, testing and is macros are supported.
  • thrown? and thrown-with-msg? are implemented as macros; unlike clojure.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 and test-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.
  • Printing of JavaScript stack trace on CLJS test errors is supported only on PhantomJS 1.6+ and modern browsers.
  • The namespaces clip-test.testutil and clip-test.testutil-cljs have common functions that provide similar functionality in Clojure and ClojureScript.

Examples

The following projects use clip-test for CLJS testing:

Development of this library

Running tests

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

Building the JAR

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

Getting in touch

On Twitter: @kumarshantanu

E-mail: kumar(dot)shantanu at gmail.com

License

Copyright © 2012 Shantanu Kumar

Distributed under the Eclipse Public License, the same as Clojure.

Something went wrong with that request. Please try again.