Provides commands to run ExUnit tests. The output is syntax highlighted and stacktraces are navigatable.
exunit is available in melpa and can be installed via package-install command.
(add-hook 'elixir-mode-hook 'exunit-mode)
;; Optionally configure `transient-default-level' to 5 to show extra switches
;; Or use `C-x l' to change the level of individual commands and switches
(setq transient-default-level 5) ;; default is 4
Currently, 2 extra switches are shown, --exclude
and --include
.
Keyboard | Description |
---|---|
C-c , a | exunit-verify-all Run all the tests in the current project |
C-c , u | exunit-verify-all-in-umbrella Run all the tests in the current umbrella project |
C-c , v | exunit-verify Run all the tests in the current buffer, or the test file corresponding to the current buffer |
C-c , s | exunit-verify-single Run the test under the point |
C-c , r | exunit-rerun Re-run the last test invocation |
C-c , t | exunit-toggle-file-and-test Toggle between a file and its tests in the current window |
C-c , d | exunit-debug Run the test under the point in IEx shell. Supports IEx.pry method for debugging. |
C-c , 4 t | exunit-toggle-file-and-test-other-window Toggle between a file and its tests in other window |
Invoking any of these commands with a prefix argument C-u
will
cause a prompt to be shown for additional arguments before the
test(s) are run.
For example, you can redefine an exunit-mix-command
to the following to execute in backend
service context:
(setq exunit-mix-command
(lambda (args)
(let* ((args (s-join " " args))
(mix-command (concat "'mix test " args "'")))
;; Adjust to your needs
(list "docker-compose" "exec" "backend" "sh" "-c" mix-command))))