-
Notifications
You must be signed in to change notification settings - Fork 129
Using midje without Leiningen
By default, Midje assumes you're using Leiningen, either directly via lein-midje or indirectly via the repl tools. (The repl tools look inside your project.clj
file to find the :test-paths
and :source-paths
.)
If you're not using Leiningen, you have to do two things:
-
Give Midje the classpath-relative locations of all the files that might contain facts. By default, this is
["test"]
. -
Arrange for the classpath to contain one or more roots that have the facts below them. (Note that Midje allows facts to appear next to source code, so one of the roots may be the root of the source tree.)
In the absence of a project.clj
file, the simplest way to satisfy (1) is to put test and source paths in your configuration files. For example, the following configuration file entry replicates the default for project.clj
:
(midje.util.ecosystem/set-leiningen-paths! {:test-paths ["test"], :source-paths ["src"]})
Classpath-setting is more tool-dependent. I hope that people who use common tools (like Immutant) will add notes to this page.
Midje can be run via Clojure CLI tools (aka tools.deps) with a one liner:
clj -e "(require 'midje.repl) (-> (midje.repl/load-facts) :failures (min 255) (System/exit))"