Clojurescript test runner

testing

#1

The last time I tried using test runner for Clojurescript, it was a bit painful to set-up (it’s been a while ago). Anything has changed since then? Should I still try using https://github.com/bensu/doo or maybe there are now (maybe better) alternatives today?

Just to be clear: I’m not asking about end-to-end aspect of testing, these kind of tests are handled by our selenium based testing in a different project.

I need a simple and fast runner that would cljs-compile source and tests and execute the tests in js-environment (e.g. nodejs). These tests are mostly based on specs which are in .cljc files. Why not test them on JVM? Simply because sometimes spec can include a generator with parts applicable only to js.

but what would be the best and less painful way to test the logic? Conform existing specs and etc.


#2

Hello, another option is using Workspaces: https://github.com/nubank/workspaces

Workspaces is like Devcards but more focused in component development experience, and it includes test runners for running single tests, ns tests or the full suite (and AFAIK is the only UI tool that has this feature that I know of, to run the full suite in browser).


#3

tried to setup figwheel-main with puppeteer, quite smooth experience.


#4

I like the test support in shadow-cljs:

https://shadow-cljs.github.io/docs/UsersGuide.html#_testing


#5

Thanks for asking this question. I’ve still yet to make the leap to front-end clojurescript testing (although you might be concerned with back-end cljs, I know). The top of my to-look-into list is https://github.com/igrishaev/etaoin, but that is for UI/UX testing and not as much the speccing. Doo is the default with Luminus, but that figwheel-main puppeteer combo looks pretty strong.


#6

Depending on the project it might be possible to write most of the logic and the tests for it in common Clojure .cljc. Then the Clojure test runner will at least test everything that is truly common and anything :clj.


#7

Indeed that’s possible. So my problem is - I have my specs in .cljc, but sometimes, generator part for a spec has to have logic that applicable only on front-end. It doesn’t necessarily have to be “UI-related”, but I really need to run tests in javascript platform - maybe Node, I don’t know. And I can’t find a simple way to run tests from command line.


#8

Maybe my cljs-test-runner will do the trick?