Skip to content
sritchie edited this page Sep 28, 2011 · 27 revisions

Loading files containing Midje facts, or using lein test, doesn't produce useful overall summaries. To get summaries, add the Lein-Midje plugin to Leiningen. The following makes it available to all your projects, provided you use Leiningen 1.5.2 or later:

  $ lein plugin install lein-midje 1.0.3

Or you can include it in a single project's project.clj:

      :dev-dependencies [ [lein-midje "1.0.3"] ])

You can then get this sort of summary:

 $ lein midje
 FAIL at (core.clj:7)
     Expected: 1
       Actual: 2
 FAIL at (timecop.clj:5)
     Expected: 3
       Actual: 2
 FAILURE: 2 facts were not confirmed. 

If, as I do, you like using facts as annotations in your source code, you'll be happy to know that lein midje also checks any facts in the src directory.

If your tests also contain clojure.test deftests, they'll be run, you'll get detailed failure information, and the end of the output will show the usual clojure.test summary. It'll be separate from the Midje summary because Midje doesn't make the same distinctions as clojure.test does (between errors and failures and between checks and tests).

Clone this wiki locally