diff --git a/bb.edn b/bb.edn index 510e36f..375355a 100644 --- a/bb.edn +++ b/bb.edn @@ -1,5 +1,10 @@ {:deps {dda/dda-devops-build {:local/root "."}} - :tasks - {:requires ([dda.devops-build.image :as image]) - image-build (image/dbuild {:name "myimage"})}} - + :tasks + {test + {:extra-paths ["src/test/clj"] + :extra-deps {io.github.cognitect-labs/test-runner + {:git/tag "v0.5.1" :git/sha "dfb30dd"}} + :task (exec 'cognitect.test-runner.api/test) + :exec-args {:dirs ["src/test/clj"]} + :org.babashka/cli {:coerce {:nses [:symbol] + :vars [:symbol]}}}}} diff --git a/deps.edn b/deps.edn index 95baef9..d076d5a 100644 --- a/deps.edn +++ b/deps.edn @@ -1,7 +1,3 @@ {:paths ["src/main/clj"] :deps {org.clojure/spec.alpha {:mvn/version "0.4.233"} - orchestra {:mvn/version "2021.01.01-1"}} - :aliases - {:test/env - {:extra-paths ["src/test/clj"] - :extra-deps {}}}} \ No newline at end of file + orchestra {:mvn/version "2021.01.01-1"}}} \ No newline at end of file diff --git a/src/main/clj/dda/devops_build/image.clj b/src/main/clj/dda/devops_build/image.clj index 6aecd00..5c334e2 100644 --- a/src/main/clj/dda/devops_build/image.clj +++ b/src/main/clj/dda/devops_build/image.clj @@ -1,7 +1,6 @@ (ns dda.devops-build.image (:require [orchestra.core :refer [defn-spec]] [babashka.tasks :as t] - [clojure.string :as str] [dda.devops-build.devops :as d] [dda.devops-build.devops.domain :as dd] [dda.devops-build.image.domain :as domain])) diff --git a/test-runner.clj b/test-runner.clj new file mode 100644 index 0000000..b4a5d86 --- /dev/null +++ b/test-runner.clj @@ -0,0 +1,15 @@ +#!/usr/bin/env bb + +(require '[clojure.test :as t] + '[babashka.classpath :as cp]) + +(cp/add-classpath "src:test") + +(require 'your.test-a 'your.test-b) + +(def test-results + (t/run-tests 'your.test-a 'your.test-b)) + +(let [{:keys [fail error]} test-results] + (when (pos? (+ fail error)) + (System/exit 1))) \ No newline at end of file diff --git a/tests.edn b/tests.edn new file mode 100644 index 0000000..0d45f7d --- /dev/null +++ b/tests.edn @@ -0,0 +1,38 @@ +#kaocha/v1 +{:kaocha/tests + [{:kaocha.testable/id :unit + :kaocha.testable/type :kaocha.type/clojure.test + :kaocha/ns-patterns ["-test$"], + :kaocha/source-paths ["src/test/clj" "src/test/cljc"], + :kaocha/test-paths ["src/test/clj" "src/test/cljc"], + :kaocha.filter/skip-meta [:kaocha/skip]} + + {:kaocha.testable/id :generative-fdef-checks + :kaocha.testable/type :kaocha.type/spec.test.check + :kaocha/source-paths ["src/main/clj" "src/main/cljc"] + :kaocha.spec.test.check/checks [{:kaocha.spec.test.check/syms :all-fdefs + :clojure.spec.test.check/instrument? true + :clojure.spec.test.check/check-asserts? true + :clojure.spec.test.check/opts {:num-tests 10}}]} + ] + + :kaocha/reporter [kaocha.report/documentation] + + :kaocha/color? #profile {:default true + :ci false} + + ;; Run tests of file changes, unless running in CI server + :kaocha/watch #profile {:default true :ci false} + + :kaocha/fail-fast? true + + :kaocha.plugin.randomize/randomize? false + + :kaocha/plugins + [:kaocha.plugin/randomize + :kaocha.plugin/filter + :kaocha.plugin/capture-output + :kaocha.plugin.alpha/spec-test-check] + + :kaocha.plugin.capture-output/capture-output? true + } \ No newline at end of file