A minor Emacs mode for running Expectations, based upon Clojure test mode.
Note that this is designed for classic expectations, and will not work with the clojure.test version
This package has some major breakage due to changes in the cider API and removal of legacy Emacs functions.
It is probably better to look at CIDER's built-in test features. CIDER has several functions to help you run all your tests.
Please note Expectations v1.3.7 or greater is required to use expectations-mode.
expectations-mode is not in MELPA, so you must install the package manually.
Download expectations-mode.el, put it somewhere on your Emacs load path, and require it inside of init.el
(require 'expectations-mode)
This will add a clojure-mode-hook
to enable expectations-mode
whenever a Clojure test file is opened that has a namespace with
'expectations.' or '-expectations' inside of it.
For example namespaces like...
(ns myproject.expectations.core
(:use expectations))
(ns myproject.core-expectations
(:use expectations))
...will cause expectations-mode
to automatically activate. Where as
namespaces like:
(ns myproject.test.core
(:use clojure.test))
...will be ignored.
Expectations colourises its output by default. To turn this off and get rid of the annoying characters in your output, add this to your init.el in an appropriate place:
(setenv "EXPECTATIONS_COLORIZE" "false")
Current key mappings are:
C-c , run tests in ns
C-c C-, run tests in ns
C-c k clear test results
C-c ' show message for test under cursor
The keybindings are a subset of the bindings used in
clojure-test-mode
and work the same way.
The shortcuts to run individual tests are not required, as you
generally use the -focus
version of the expectations macros to run
an expectation in isolation.
Distributed under the GNU General Public License; see C-h t to view.