Hi All,


I know TDD carries a bit of a stigma in the Clojure(script) community but I 
find it valuable. I thought I'd share my test harness for local development 
so others could use it/comment on it.

The main benefit I see to this test harness is;

   1. it's quick as figwheel is.
   2. it has desktop notifications.
   3. it uses vanilla cljs.test/deftest and cljs.test/run-all-tests rather 
   than another macro.


I plan to write up a blog post on it but you can try it by doing the 
following;

   1. clone https://github.com/nfisher/lein-nashtest.
   2. lein figwheel.
   3. browse to http://0.0.0.0:3449/test.html.
   4. accept notifications.
   5. cause the test to fail in cljs/jbx/pants_test.cljs.
   6. fix the test and see a passing notification.

The failure notification looks as follows;

<https://lh3.googleusercontent.com/-Vq1BC6y50cM/WiUExdX1SZI/AAAAAAAAGWg/kTMzig4RYHU2PWStfXZkKAhJCSAeqLv5wCEwYBhgL/s1600/Screen%2BShot%2B2017-12-04%2Bat%2B05.12.45.png>

And the browser looks as follows with a failure;


<https://lh3.googleusercontent.com/-AFiBKq-n--U/WiUFMRy7NII/AAAAAAAAGWk/SHOqxGH2ykoAxYJsHjlbOUbbrtWjAKUAwCLcBGAs/s1600/Screen%2BShot%2B2017-12-04%2Bat%2B05.13.07.png>

Looking under the hood you'll see it's a bit hack-ish essentially there's 
two bits to it;


   1. figwheels :js-onload.
   2. overriding console.log and taking actions on particular values. Using 
   the cljs.test/report multi-method would probably be a better approach 
   long-term.
   
If you wanted to use the test harness in your own project you can simply 
add a cljsbuild target similar to figtest in my projects build and copy 
test.html into your $project/resources/public folder.

Cheers!
Nathan

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to