Installation

In order to install Speclj, you must have Leiningen version 2.0 or later.

Clojure

Install with Leiningen

  • Include speclj in your :profile, :plugins and add "spec" to the :test-paths array.
    
        :profiles {:dev {:dependencies [[speclj "2.5.0"]]}}
        :plugins [[speclj "2.5.0"]]
        :test-paths ["spec"]

  • Leiningen will download Speclj the first time you run a spec.
:cljsbuild ~(let [run-specs ["bin/speclj" "target/tests.js"]]
              {:builds
               {:dev {:source-paths ["src/cljs"  "spec/cljs"]
                      :compiler {:output-to "target/tests.js"
                                 :pretty-print true}
                      :notify-command run-specs
                      }}
               :test-commands {"test" run-specs}})

}

Install Manually

  • Make sure you have Git
  • Check out the source code from our repository.
  • Run "lein jar" from your terminal while in the speclj directory.

ClojureScript

  • Include speclj in your :profile and :plugins:
    
        :profiles {:dev {:dependencies [[speclj "2.5.0"]]}}
        :plugins [[speclj "2.5.0"]]
        :test-paths ["spec"]
      

  • Add the code below to your ':cljsbuild' map. Adjust your 'src' and 'spec' locations accordingly.
    
    :cljsbuild ~(let [run-specs ["bin/speclj" "target/tests.js"]]
                  {:builds
                   {:dev {:source-paths ["src/cljs"  "spec/cljs"]
                          :compiler {:output-to "target/tests.js"
                                     :pretty-print true}
                          :notify-command run-specs
                          }}
                   :test-commands {"test" run-specs}})
    
    }
    

  • Create a file named 'speclj' in a 'project-source/bin' directory and copy the contents below:
    
    #! /usr/bin/env phantomjs
    
    var fs = require("fs");
    var p = require('webpage').create();
    var sys = require('system');
    
    p.onConsoleMessage = function (x) {
    fs.write("/dev/stdout", x, "w");
    };
    
    p.injectJs(phantom.args[0]);
    
    var result = p.evaluate(function () {
    speclj.run.standard.armed = true;
    return speclj.run.standard.run_specs(
    cljs.core.keyword("color"), true
    );
    });
    
    phantom.exit(result);
    

  • Now the files in your spec folder should run