Skip to content

Commit 3001e40

Browse files
committed
Switch to kaocha for running tests
This is in anticipation of adding some clojure.spec-based generative tests, which the official test runner doesn't support well.
1 parent a6fb5cc commit 3001e40

File tree

5 files changed

+24
-24
lines changed

5 files changed

+24
-24
lines changed

bb.edn

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,11 @@
33
org.babashka/spec.alpha {:git/url "https://github.com/babashka/spec.alpha"
44
:git/sha "951b49b8c173244e66443b8188e3ff928a0a71e7"}}
55
:tasks
6-
{:requires ([docker-clojure.core :as dc])
6+
{:requires ([babashka.deps :as deps]
7+
[docker-clojure.core :as dc])
78
clean (dc/-main "clean")
89
dockerfiles {:depends [clean]
910
:task (apply dc/-main "dockerfiles" *command-line-args*)}
1011
manifest (apply dc/-main "manifest" *command-line-args*)
1112
build-images {:task (apply dc/-main "build-images" *command-line-args*)}
12-
test {:extra-paths ["test"]
13-
:requires ([docker-clojure.test-runner :as tr])
14-
:task (tr/-main
15-
'docker-clojure.core-test
16-
'docker-clojure.docker-test
17-
'docker-clojure.dockerfile-test
18-
'docker-clojure.manifest-test
19-
'docker-clojure.variant-test)}}}
13+
test (deref (deps/clojure '-X:test))}}

deps.edn

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
:parallelization 2}}
1212

1313
:test {:extra-paths ["test"]
14-
:extra-deps {com.cognitect/test-runner
15-
{:git/url "https://github.com/cognitect-labs/test-runner.git"
16-
:sha "9d36f36ff541dac680a05010e4348c744333f191"}}
17-
:main-opts ["-m" "cognitect.test-runner"]}}}
14+
:extra-deps {lambdaisland/kaocha {:mvn/version "1.91.1392"}
15+
orchestra/orchestra {:mvn/version "2021.01.01-1"}
16+
org.clojure/test.check {:mvn/version "1.1.1"}}
17+
:exec-fn docker-clojure.fix-kaocha/run-tests
18+
:exec-args {}}}}

test/docker_clojure/fix_kaocha.clj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(ns docker-clojure.fix-kaocha
2+
"Kaocha often has bugs with tools-deps exec-fn usage because they have two
3+
different entry points (and one doesn't use the other). They insist on
4+
everyone using a `bin/kaocha` script to run their tests even though that is
5+
inconsistent with most Clojure tooling idioms. This ns exists to work around
6+
bugs we encounter and make kaocha behave better."
7+
(:require [clojure.spec.alpha :as spec]
8+
[expound.alpha :as expound]
9+
[kaocha.runner :as kaocha]))
10+
11+
(defn run-tests
12+
[opts]
13+
;; work around https://github.com/lambdaisland/kaocha/issues/445
14+
(binding [spec/*explain-out* expound/printer]
15+
(kaocha/exec-fn opts)))

test/docker_clojure/test_runner.clj

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests.edn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#kaocha/v1 {:plugins [:kaocha.plugin.alpha/spec-test-check]}

0 commit comments

Comments
 (0)