This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-17
Channels
- # announcements (8)
- # atom-editor (8)
- # aws (1)
- # babashka (96)
- # beginners (128)
- # calva (7)
- # cider (12)
- # cljsrn (1)
- # clojure (75)
- # clojure-europe (28)
- # clojure-hamburg (2)
- # clojure-italy (7)
- # clojure-nl (7)
- # clojure-norway (3)
- # clojure-uk (13)
- # clojurescript (26)
- # conjure (2)
- # cursive (18)
- # data-science (7)
- # datalog (21)
- # datomic (9)
- # duct (15)
- # expound (29)
- # figwheel-main (14)
- # fulcro (59)
- # helix (4)
- # jobs (2)
- # kaocha (19)
- # leiningen (15)
- # luminus (4)
- # malli (57)
- # meander (2)
- # off-topic (2)
- # pathom (12)
- # pedestal (8)
- # re-frame (53)
- # reitit (9)
- # remote-jobs (1)
- # shadow-cljs (64)
- # spacemacs (1)
- # specter (2)
- # tools-deps (12)
- # tree-sitter (2)
- # vim (11)
- # xtdb (17)
hello everyone, I see that version 0.8.0
introduced `:duct.profile/test`
but I dont see any mention on how to use it, what it enables me to do ?
ideally id like to create a test.edn
somewhere and I when ran lein test
that config gets merged with the dev one.
Is there something like that already implemented or ill need to write a fixture of my own, parse both edn files, merge then, then use ig/init
passing that configuration?
if you are you're initiating the configuration in your fixture you can add the :duct.profile/test
key to the initializing function
not sure if I got you, a little bit more context: I was using 0.7.0, upgraded to 0.8.0, what I need to modify for it to work?
You could use integrant.repl
to manage it for you in the tests.
(defn- read-config []
(duct/read-config (io/resource "my-app/config.edn")))
(defn init-system []
(duct/load-hierarchy)
(integrant.repl/set-prep! #(duct/prep-config (read-config) [:duct.profile/test])) ;; <<<<< TEST PROFILE GOES HERE
(integrant.repl/go))
(defn halt-system []
(integrant.repl/halt))
(defn once-fixture [tests]
(init-system)
(tests)
(halt-system))
(use-fixtures :once once-fixture)
@UG9U7TPDZ just out of curiosity, why not use ig/init
and ig/halt!
?
it seems a bit strange to me to use code designed to be used in the repl in a test configuration, thats why I ask