I’m struggling to find a good workflow for writing node tests in clojurescript. There are a couple of problems I’m running into that I can’ find good solutions for:
Unable to run a single test at a time.
I’m writing browser automation specs using webdriverio, which are relatively slow. So I’d like to be able to just run one test at a time (even for normal tests this would be nice). The only problem is that there doesn’t seem to be any way to do that. The recommended approach for clojure is to run test-vars, but that doesn’t seem to run fixtures in clojurescript. Even if there was a way to run one test at a time from the REPL, connecting to a repl presents its own challenges.
Can’t connect to nREPL easily
I’m using shadow-cljs for building, and so I need to run the javascript in order to connect via repl and do some repl driven development. The problem is that it’s a node-test build so when I run it, it’ll just run the tests and then exit. My current solution is to create a separate build that targets node-script, create a ns that loads all of the test namespaces, then watch / run that script so that I can connect to it via the repl in my editor. This is obviously pretty hacky and not even that reliable.
If anyone out there is writing node tests in clojurescript, I would love to hear your experience and what your workflow is.
Steps 4 and 5 I usually do in my editor. I use vim with vim-iced and have a keybinding to send :IcedEval (run-test *symbol-under-cursor*). I think the next step would be to run whatever test the cursor is in, instead of needing the cursor to be on the specific symbol itself, but I haven’t gotten that far yet.