This covers version 3.x+ of
lein midje, which only runs under Leiningen 2 and Midje 1.5.X+. For information on older versions, use
lein help midje.
lein midje options were covered in lein-midje basics. They are:
% lein midje # Check facts in source and test namespaces % lein midje proj.ns-1 proj.ns-2 # Check facts in selected namespaces % lein midje proj.subproj.* # Check facts in a subtree of namespaces % lein midje :autotest # Check all facts once; recheck changed namespaces.
lein midje has further options. Options have Clojure keyword syntax. (Thus,
:autotest is an option.) When options take arguments, they are all the following tokens, up to the next option or the end of the arguments.
The arguments are pathnames that override Midje's default configuration files. Here's an example:
% lein midje :config /Users/marick/alternate-config configs/integration
:configoption is given.
As a result of the last,
:config with no arguments means that Midje reads no config files.
Autotest works in terms of directories full of Clojure files, not namespaces. You can limit which directories it considers by giving it specific directories:
% lein midje :autotest test/midje/util src/midje/util
:autotestat individual files.
Midje facts have metadata that allows you to tag them with arbitrary information. Here are three examples:
(fact "this is an ordinary test" ...) (fact "this is a core test" :core ...) (fact "this is a slow test" :slow ...) (fact "this is a slow core test" :core :slow ...)
:filter option allows you to restrict which facts in the already-selected namespaces are run. For example, to check the core facts in all the namespaces, you'd use:
% lein midje :filter core
To run the core tests in only the utility directory, you'd use:
% lein midje utility.* :filter core
Filter terms can be negated by preceding them with
-. Here is how you'd autotest all the facts that aren't marked as slow:
% lein midje :autotest :filter -slow
When there is more than one filter term, facts that match any of them are run. For example, the following runs all the fast (not
:slow) tests, but runs core tests even if they're slow.
% lein midje :filters -slow core
:filters is a synonym for