Fork me on GitHub

@borkdude the examples you'll see around typically show unit tests (or data-driven... testing functions in isolation), using deftest, run-tests, etc from cljs.test. But those testing macros are extremely non-specific and one of the perks of running tests client-side is you could have direct access to real UI components (avoiding either the need for e.g. Selenium to drive your tests, or a headless browser like PhantomJS that can be kinda painful when debugging). I see no reason why the basic cljs.test test runner couldn't handle higher-level UI/acceptance tests


I think a good approach could use :extra-mains to set up a testing endpoint on its own page, where you could render various components separately onto the page and then test them. At least if you're using something React-based and can set up state / pass props as needed for each test. With a bit of creativity and a custom reporter (or just use devcards) you could show test results under each rendered component. You could also just run-tests with your whole app loaded, but seems harder and probably slower.


Either way you'd have to be careful about async. Reload, reset DOM/event handlers/state, then trigger run tests (tests probably async too)... you might get some ideas from and how cljs-test-display does its reloadable setup Also you might find using devcards (with its devcards-test macro) could be a really nice way to render components and their test results together.


I’m using figwheel main, but removed the test path in deps.edn. But when I change something there, it still watches that path after restarting


Hmmmm have you manually set :watch-dirs?


Yeah figwheel doesn’t know which directories you want watched


:fig {:extra-deps
                 {com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}
                  com.bhauman/figwheel-main {:mvn/version "0.1.9"}}
                 :extra-paths ["src" #_"target"]}


(I also excluded target just to be sure)


Gotcha you need to set :watch-does


it’s not set in my generated figwheel-main.edn which is only comments, so I’ll add it


You’re better off setting it as metadata on dev.cljs.edn


oh there it is yes


works like intended now, thanks