Prevent from running facts when they are encountered

18 views
Skip to first unread message

Ivan Willig

unread,
Nov 23, 2015, 6:02:52 PM11/23/15
to Midje
Hello,

We are using midje with cider's `clj-refactor` mode. We also use the
reloaded workflow with reloaded.repl library

We have noticed that both clj-refactor and the reloaded.repl causes
all of the midje facts to be run when a namespace is recompiled or
reloaded. With clj-refactor this seems to happen with the repl is
started and with reloaded.repl this seems to happen on every `reset`.  Since
we have a couple of thousand facts this can take quite a
while. It seems that it also causes the cider repl to crash, but
maybe that is my setup. Anyway, we would like a way to prevent the
facts to be run when the namespace is loaded or re compiled.

I have looked into wrapping all of our facts with in a `deftest`, but
this seems less than an ideal solution. For one, error reporting in
midje seems to lose the line number form the error assertion when using `deftest`. 
You can see an example of this here,





I believe this is a result of an interaction between midje and
`deftest` as this worked correctly before wrapping our facts in a
deftest.

Anyway we have really enjoyed using midje and would like to keep using it.

Does anyone have any suggestions on how to prevent midje facts from
being auto run while not using deftest?

Thank you

Brian Marick

unread,
Dec 13, 2015, 5:11:20 PM12/13/15
to mi...@googlegroups.com
Terribly sorry for the slow reply, especially as the answer is (probably) simple. There's a configuration setting you can use, called `:check-after-creation`. Set it to false. See this in the wiki:

https://github.com/marick/Midje/wiki/Configuration-files

Ivan Willig wrote:
> Hello,
>
> We are using midje with cider's `clj-refactor` mode. We also use the
> reloaded workflow with reloaded.repl
> <https://github.com/weavejester/reloaded.repl> library
>
> We have noticed that both clj-refactor and the reloaded.repl causes
> all of the midje facts to be run when a namespace is recompiled or
> reloaded. With clj-refactor this seems to happen with the repl is
> started and with reloaded.repl this seems to happen on every `reset`.
> Since
> we have a couple of thousand facts this can take quite a
> while. It seems that it also causes the cider repl to crash, but
> maybe that is my setup. Anyway, we would like a way to prevent the
> facts to be run when the namespace is loaded or re compiled.
>
> I have looked into wrapping all of our facts with in a `deftest`, but
> this seems less than an ideal solution. For one, error reporting in
> midje seems to lose the line number form the error assertion when
> using `deftest`.
> You can see an example of this here,
> <https://lh3.googleusercontent.com/-Yy57AevpRLg/VlN5_Mnjp_I/AAAAAAAAA_c/Nb2YzIGHsVY/s1600/Screen%2BShot%2B2015-11-23%2Bat%2B3.34.22%2BPM.png>
>
>
>
>
> I believe this is a result of an interaction between midje and
> `deftest` as this worked correctly before wrapping our facts in a
> deftest.
>
> Anyway we have really enjoyed using midje and would like to keep using it.
>
> Does anyone have any suggestions on how to prevent midje facts from
> being auto run while not using deftest?
>
> Thank you
>
> --
> You received this message because you are subscribed to the Google
> Groups "Midje" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to midje+un...@googlegroups.com
> <mailto:midje+un...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages