Skip to content

Example projectsλ︎

Sean Corfield - user managerλ︎

User manager has unit tests that also include an embedded database. Tests can run with the Cognitect Labs test runner.

:test alias includes the test path and a dependency for the H2 database

Cognitect Labs test runner included in the project deps.edn file as :runner

clojure -M:test:runner will run the Cognitect Labs runner and include the dependency to run the in-memory database used for the tests.

Using koacha with Sean Corfield user managerλ︎

Adding a test.edn file is not sufficient for testing this project with lambdaisland/kaocha, as the H2 dependency is also needed.

Create a bin/koacha script and add the extra alias

#!/usr/bin/env bash
clojure -M:test:test-runner-kaocha "$@"

Status Monitorλ︎

Status monitor is a Leiningen project.

Include a :kaocha profile in the project.clj file, adding the koacha dependency. The :kaocha alias sets the main namespace and uses the kaocha profile.

  {:dev    {:dependencies [[javax.servlet/servlet-api "2.5"]
                           [ring/ring-mock "0.3.2"]]}
   :kaocha {:dependencies [[lambdaisland/kaocha "1.0.632"]]}}
  :aliases {"kaocha" ["with-profile" "+kaocha" "run" "-m" "kaocha.runner"]}

lein kaocha will run all the tests