Optionally disable generated pre/post-conditions in tests
dzhus opened this issue · 3 comments
Context
When introducing nedap/speced.def
to an existing code base it may be desirable to disable pre/post conditions produced from speced/defn
* forms when running lein test
s. Setting :global-vars {*assert* false}
does not fix that (I believe it's mentioned in technomancy/leiningen#1108).
I'm not sure if it's actually solvable on speced.def
level (this seems to be due to Clojure lacking a good way to flip *assert*
value) but would appreciate any thoughts on how to achieve the above.
Acceptance criteria
There's documentation on how to disable generated conditions when running lein test
.
Hi!
Thanks for the interest in speced.def. Part of the point of speced.def is catching mistakes in tests, but yes, it can be worth it to have an extra run in CI with *assert*
bound to false.
:global-vars {*assert* false}
just works. I tried it again now for good measure. It also can be a good idea to add :target-path "target/%s"
so that dev, prod and test artifacts don't interfere with each other.
AOT should be disabled as well (as it is highly recommendable anyway for dev/test) and you should perform a lein clean
in case of doubt.
Let us know if that worked, otherwise please reflect a specific problem (e.g. stacktrace, repro steps).
Cheers - V
Hi, thank you for your response. After further investigation I realised that the issue in my case was due to presence of dev/user.clj
in the project, which required some namespaces with pre/post conditions injected, and due to the nature of dev/user.clj
this happens before :global-vars {*assert* false}
is picked up. Sorry for the false alarm!
No issue!
And yes, it tends to be a good idea to decouple :dev and :test profiles.