Running unit tests in Cider

SPC p a switches between source and test buffers.

, t n run all tests in the current namespace. This also loads any changes to those tests.

, t a run all tests. If tests are changed or added, , e f to evaluate those tests to add them to the REPL or , e b on any test buffers that have changed.

The results of running the tests are displayed in the mini-buffer, showing the number of tests run and how many passed and failed.

Spacemacs Cider tests - results in mini-buffer

Run tests from test code buffer

Run tests from the buffer containing the test source code buffer, as this ensures all test code is loaded and the latest version of the tests are run.

Tests can be run from the source code buffer, however, only test code that has been evaluated in the REPL will run.

Running tests in the REPL buffer

, to open the REPL command menu and select run tests

Auto Unit Test Mode

, T t to toggle auto test mode

, e b will evaluate the current buffer and automatically run all tests.

CIDER test report only created on test failure

To show a test report each time tests are run, add the variable cider-test-show-report-on-success t in the clojure layer list of the .spacemacs file.

     (clojure :variables
              clojure-enable-linters 'clj-kondo
              cider-test-show-report-on-success t)

results matching ""

    No results matching ""