Fork me on GitHub
#figwheel
<
2018-12-14
>
mokr14:12:31

Hi all. Does anyone know what the requirement for :auto-testing is? I’ve tried adding it to a Luminus based project (based on template v3.10.22), but figwheel complains that the key is unrecognized. My goal is to get some sensible Clojurescript testing up and running. I love how testing works in Clojure, but Clojurescript side has been a pain and it feels a bit wrong to move all my logic to cljc to have a good experience. Any help appreciated.

vaz23:12:35

Hi @U1S4F3M4M. That Luminus template uses lein-fighweel, right? I think the :auto-testing option is only in Figwheel-Main, which is a rewrite of lein-figwheel. But you can do auto-testing with lein-figwheel, too, just configured differently. I think the :auto-testing feature basically just sets up another build with its own code entrypoint, HTML host file, and HTTP endpoint to serve it. It also uses [bhauman/cljs-test-display](https://github.com/bhauman/cljs-test-display) to display test results on the page (instead of in console logs). With lein-figwheel, I think the approach to running cljs tests could be pretty much the same idea, but the config is a bit less automatic. You'd set up a separate :cljsbuild build for running tests, with its own :output-to target and its own :main (something like myapp.core-test). Another HTML file in your resources/public would load the JS outputted by the test build and run the tests. It could include cljs-test-display too, see its README for how to add it, it's a one-liner in the test file I think. You can run both builds in one lein command (something like lein figwheel dev test). I'm short on specifics because I haven't done exactly this but hopefully it helps. Try #lein-figwheel for specific help with it maybe, or check out the output of various other lein template projects that may include auto cljs testing.

mokr09:12:07

Hi @U3HMZGQ3S. Thanks for taking the time to answer this on. You are confirming what I had started to suspect. Namely that I should read up on figwheel-main. I was initially not aware that it existed as I’ve happily used Luminus with lein-figwheel working out-of-the-box. But, I always knew that it might bit me down the road not to have set up everything myself… As for the problem I actually ended up moving the critical code to cljc with test coverage, as I might end up using that code from Clojure as well. Thanks again.