This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-27
Channels
- # arachne (1)
- # beginners (31)
- # boot (84)
- # cider (9)
- # clara (2)
- # cljs-dev (102)
- # cljsrn (20)
- # clojure (254)
- # clojure-belgium (1)
- # clojure-dusseldorf (17)
- # clojure-greece (7)
- # clojure-italy (6)
- # clojure-russia (2)
- # clojure-spec (8)
- # clojure-uk (9)
- # clojurescript (93)
- # component (4)
- # copenhagen-clojurians (1)
- # cursive (24)
- # datomic (22)
- # editors (1)
- # emacs (8)
- # garden (2)
- # hoplon (357)
- # lein-figwheel (1)
- # leiningen (4)
- # luminus (27)
- # mount (13)
- # off-topic (7)
- # om (71)
- # onyx (35)
- # planck (3)
- # re-frame (53)
- # reagent (35)
- # ring-swagger (24)
- # specter (10)
- # sql (6)
- # untangled (47)
- # vim (157)
I can run all my tests in my test namespace from within my IDE (Cursive), but I can’t run ‘lein test’. When I do that, it seems like lein tries to load and execute all namespaces, even though I exclude the problematic parts (the function that tries to connect to a local database) from my test namespace. Is there any work around? I can redefine the function that connects to the local database, but that feels like a hack.
Many consider it poor form to execute side-effecting code when requiring a namespace
They would advocate rolling up your startup stuff either into a namespace not (indirectly) required by your tests, and/or require e.g. an init!
fn call to do all the startup stuff
Others might say make the function that connects to the local database context-aware, so it connects to the right database depending on if it’s running in a test environment or not