Fork me on GitHub
#clojurescript
<
2020-01-11
>
Michael16:01:44

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?

roman01la16:01:14

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

Michael17:01:28

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

andy.fingerhut18:01:03

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

andy.fingerhut18:01:30

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.