Fork me on GitHub

Hi. I would like to implement a library that runs on both clojure and clojurescript. I would also like to write my unit tests in a way that works in both cases. What would you suggest I use as testing framework? Can I use clojure.test and cljs.test and just use reader conditionals to require them in clj / cljs respectively?


Yes you can, I think even in cljs you can require clojure.test and cljs will resolve it to cljs.test


Ah, cool. I just tried it and it works. So no need for reader conditionals. Thanks!


You can write tests that are nearly identical for both in a .cljc file with reader conditionals for the few differences, if you want.


If you have tests that you want only to run for clj, put them in a .clj test file. Similarly if you have tests that you want only run for class.