Skip to content
marick edited this page Jan 20, 2013 · 10 revisions

##Installation

lein-midje is a plugin, so add this to your ~/.lein/profiles.clj:

{:user {:plugins [[lein-midje "3.0-alpha4"]]}}

Or you can include it in your project.clj:

{:profiles {:dev {:plugins [[lein-midje "3.0-alpha4"]]}}}

Use

###Check everything

% lein midje

This loads all files in your project's :tests and :sources directories (by default, test and src). Facts are checked as they're loaded unless you've changed Midje's configuration. Further, all clojure.test tests are loaded. Output looks like this:

>>> clojure.test summary:
Ran 17 tests containing 20 assertions.
0 failures, 0 errors.
>>> Midje summary:
All claims (2284) have been confirmed. 

The exit status is 0 if there are no failures, 1 otherwise.

Check a subset of the namespaces

% lein midje scratch.t-core scratch.util.*

Only namespaces matching the arguments are loaded. In the case of the wildcard argument, it would match namespaces like scratch.util.t-foo, scratch.util.foo.bar.baz.t-quux, and so on.

All other behavior is the same as the no-argument case.

Filtering facts by metadata

% lein midje :filter integration          # only integration tests
% lein midje scratch.t-core -integration  # only non-integration tests

###Autotest

% lein midje :autotest

This begins by loading all the files in the project's :test and :source directories. Thereafter, it monitors loaded files for changes. When one changes, it is reloaded. Moreover, all the files that depend on it, either directly or indirectly, are also reloaded. Facts are thereby checked. clojure.test tests are also rerun.

###Selective autotest

% lein midje :autotest test

One or more arguments after the :autotest restricts the loading and monitoring to files within the given directories. (Note: not namespaces). The directories are relative to the project root.

Clone this wiki locally