LightTable, remote REPL and clojure.test
Steps to quickly iterate when writing integration tests, by avoiding JVM load overhead between each test run:
1. Add to project.clj
:dependencies [[lein-light-nrepl "0.1.0"]] :repl-options {:nrepl-middleware [lighttable.nrepl.handler/lighttable-ops]}
2. Run REPL
$ lein repl
It will print something similar to:
nREPL server started on port 56139 on host 127.0.0.1 - nrepl://127.0.0.1:56139 REPL-y 0.3.5, nREPL 0.2.6 Clojure 1.6.0
Note the port number - 56139 in this case.
3. In REPL, load clojure.test namespaces, and the namespace you want to test:
(require '[clojure.test :refer [run-tests test-vars]]) (require ‘test.something :reload-all)
The :reload-all option is handy, because it forces REPL to fully reload the namespace and all its dependencies.
4. Open LightTable and connect to this remote REPL. First, open “Connections” view, then click “Add Connection”, and then “Clojure (remote nREPL)”. Paste your port number in the dialog that will pop up.
5. Modify test file (in this example, the test/something.clj), then reload it in remote REPL by pressing ctrl + shift + enter (or cmd + shit + enter on Mac).
6. Run all tests for this namespace, or selected tests only:
(run-tests 'test.something) (test-vars [#'test.something/one-test-only])
Repeat steps 5 and 6.








