-
Notifications
You must be signed in to change notification settings - Fork 128
Print levels
Print levels are available in Midje 1.5+
The verbosity of Midje's output can be controlled in several ways. They all use Midje's print levels. The default print level is :print-normally
. There are levels below it:
-
:print-no-summary
(-1)This causes Midje to omit its normal summary message, which otherwise looks like this:
All claims (17) have been confirmed.
-
:print nothing
(-2)There is no output. However, Midje still keeps track of pass/fail counts. You can check whether a fact fails by checking whether it returned true or false. You can check how many of a stream of facts failed by querying the return value, which will be a map like
{:failures 23}
.
There are also more verbose print levels:
-
:print-namespaces
(1)Whenever a fact in from a new namespace is about to be checked, Midje prints information like this:
= Namespace midje.parsing.t-arglists
-
:print-facts
(2)This prints the doc string of facts before they're checked:
Checking eagerly doesn't barf on sorted-sets with custom comparators... See issue: #158
If there is no doc string, the file and line number are printed
Each symbolic (keyword) print level is associated with an integer. You can use that integer wherever a print level is called for. So, if you like shorthand, you can speak of "print level 2" instead of :print-facts
.
You can set a print level in a [configuration files|configuration file]. This is the appropriate command:
(change-defaults :print-level :print-namespaces)
You can also dynamically wrap a section of code with a print level:
(require '[midje.config :as config])
(config/at-print-level :print-facts
...some facts here...)
Many of the [repl tools] take a print-level argument:
(load-facts 'namespace :print-facts)