This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-11
Channels
- # architecture (1)
- # babashka (61)
- # babashka-sci-dev (1)
- # beginners (85)
- # calva (112)
- # clj-kondo (279)
- # cljdoc (16)
- # cljs-dev (15)
- # cljsrn (7)
- # clojure (168)
- # clojure-europe (36)
- # clojure-nl (10)
- # clojure-spec (6)
- # clojure-uk (5)
- # clojured (1)
- # clojurescript (20)
- # core-async (16)
- # crypto (2)
- # cursive (13)
- # datomic (25)
- # events (7)
- # fulcro (21)
- # google-cloud (3)
- # graalvm (2)
- # graalvm-mobile (2)
- # gratitude (3)
- # helix (20)
- # honeysql (4)
- # hugsql (15)
- # introduce-yourself (15)
- # leiningen (2)
- # lsp (24)
- # luminus (22)
- # malli (21)
- # meander (11)
- # midje (1)
- # other-languages (1)
- # pathom (8)
- # re-frame (5)
- # reagent (5)
- # releases (2)
- # reveal (1)
- # shadow-cljs (18)
- # spacemacs (17)
- # sql (9)
- # tools-build (12)
- # tools-deps (4)
- # vim (12)
How are you shimming Clojure.spec instrumentation in dev & test, particularly with deps.edn? I was using lein :injections
for this but find no equivalent mechanism in the deps.edn world.
A test fixture solves test
part, but I cannot find any version of this solution that doesn't require a (use-fixture ...)
at the top of every test namespace. Does someone have an alternative solution? (Recommend an improved test runner?)
Shimming in :dev
seems to have two unclean approaches.
1) Make the editor inject on cider-connect [which varies for each editor]
2) Make the app itself support spec instrumentation as part of its official config-driven initialization -- & wait until point of invocation to (require)
spec test.deps (as these aren't available in prod build)
Closest solution for dev
I've seen is https://underwhelm.net/blog/2019/12/19/tools-deps-injections/ , which works but is fragile
From reading around, seems the solution of #2 is the "best approach," but it's a heavier pitch to my new team than I'd like https://github.com/jeaye/orchestra/pull/52
as much as I'm a Lein fan / advanced user I really dislike :injections
- they don't map 1:1 to an actual Clojure future so often people end up devising non-clean solutions that other folks are certainly solving in an idiomatic way.
use-fixtures
is fine and has the advantage that it will work with basically every test runner. You can always roll a tiny linter ensuring that each ns has this declaration.
Otherwise using a bespoke test runner seems acceptable, there are a few e.g. eftest
, circleci.test
, kaocha
, Polylith's.
Hmm, I raised the use-fixtures PR but it changes 70 files. & you can't mix :use
& :each
fixtures in test. Making the linter check for the fixture is a good idea.
If the team balks I'll mention some of the other test runners; it might be a hard sell, but would be cleaner in the end.
Thanks for the thoughts & advice!