Specljs Leiningen Template

I’m very fond of Speclj, the simple, flexible Clojure spec runner we use at 8th Light. Speclj now has a ClojureScript counterpart, but like many things ClojureScript, it requires some classpath juggling and configuration to get everything working nicely. To save my future self the hassle, I put together a basic project template with Speclj and Specljs tests and autorunners both preconfigured.

If you’re using Leiningen 2, it’s as easy as:

$ lein new specljs <your project name>

Leiningen will download the template from Clojars automatically.

To start the Speclj autorunner from inside the project directory:

$ lein spec -a

Specljs tests are configured to run whenever the ClojureScript compiles. To watch for changes, rebuild and run tests automatically, start the cljsbuild auto-compiler:

$ lein cljsbuild auto

To run specljs tests once:

$ lein cljsbuild test

If you’re using pre-2.0 Leiningen, you can find the template on Clojars and the source on GitHub.

Comments