basic setup for cljs.test (updated)
My previously documented setup for cljs.test no longer works correctly (as of r2814?) for reporting whether the tests passed or failed. To fix this you need to provide a custom reporter that somehow outputs the result for external processing. I’ve borrowed from examples by Antonin Hildebrand and Andrey Antukh on how you might do this using phantomjs. See thread for their comments and samples.
You can find the updated base setup here: cljsinit. You can clone this and run using: lein cljsbuild auto test
The only changes are to the unit-test.js to retrieve the result outputted from the customer reporter. This is the other change which is in the test-runner namespace. See change.
The initial setup also uses a :notify-command on the :test cljs build configuration. This combined with “cljsbuild auto” auto runs the tests on every complile, which is great for a TDD approach. This does not help with CI setup as you need an exit-code for success/failure. To do this use :test-commands see project.clj instead are run with “lein cljsbuild test”.