Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added hyperfidle rcf project #7

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions bases/rcf/deps.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{:paths ["src"]
:deps {com.hyperfiddle/rcf {:mvn/version "20220405"}}
:aliases {:test {:extra-paths ["test"]
:extra-deps {}}
:itest-runner {:extra-paths ["test"]
:extra-deps {lambdaisland/kaocha {:mvn/version "1.66.1034"}
lambdaisland/kaocha-cloverage {:mvn/version "1.0.75"}
orchestra/orchestra {:mvn/version "2021.01.01-1"}
org.slf4j/slf4j-simple {:mvn/version "2.0.0-beta1"}}
:jvm-opts ["-XX:-OmitStackTraceInFastThrow"
;; Run RCF tests when loading files in REPL
;; https://github.com/hyperfiddle/rcf#ci
"-Dhyperfiddle.rcf.generate-tests=true"]
:main-opts ["-m" "kaocha.runner" "--reporter" "kaocha.report/documentation"]}}}
8 changes: 8 additions & 0 deletions bases/rcf/src/polylith_kaocha/rcf/src_ns.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(ns polylith-kaocha.rcf.src-ns
(:require [hyperfiddle.rcf :refer [tests]]))

(tests

(+ 1 1) := 2

)
8 changes: 8 additions & 0 deletions bases/rcf/test/polylith_kaocha/rcf/sample_test.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(ns polylith-kaocha.rcf.sample-test
(:require [hyperfiddle.rcf :refer [tests]]))

(tests

(= 1 1) := true

)
8 changes: 8 additions & 0 deletions bases/rcf/test/polylith_kaocha/rcf/test_ns.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(ns polylith-kaocha.rcf.test-ns
(:require [hyperfiddle.rcf :refer [tests]]))

(tests

(+ 1 1) := 2

)
12 changes: 12 additions & 0 deletions bases/rcf/tests.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
;; this config is for standalone kaocha
;; run tests with clojure -M:itest-runner
#kaocha/v1
{:num-tests 10000000
:tests [{:id :unit
:test-paths ["test" "src"]
:ns-patterns [".*"]}]
:plugins [:kaocha.plugin/cloverage
:kaocha.plugin.alpha/spec-test-check]
:reporter #profile {:ci kaocha.report/documentation
:default kaocha.report/dots}
:cloverage/opts {:summary? true :html? true :emma-xml? true :codecov? true}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
[polylith-kaocha.kaocha-wrapper.runner :as core]))

(defn run-tests [opts]
(println "Run tests" opts)
(core/run-tests opts))
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[kaocha.plugin]
[kaocha.report]
[kaocha.result]
[kaocha.runner]
[kaocha.specs]
[polylith-kaocha.kaocha-wrapper.config :as config]
[slingshot.slingshot :refer [try+]]))
Expand Down
16 changes: 14 additions & 2 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@

;; poly modules workaround for Cursive, https://github.com/cursive-ide/cursive/issues/2554
"bases/example/src"
"bases/rcf/src"
"bases/test-runner/src"
"components/kaocha-test-runner/src"
"components/kaocha-wrapper/resources"
"components/kaocha-wrapper/src"
"components/util/src"]
:extra-deps {org.clojure/clojure {:mvn/version "1.11.1"}

;; poly modules
polylith-kaocha.bases/example {:local/root "bases/example"}
polylith-kaocha.bases/test-runner {:local/root "bases/test-runner"}
Expand All @@ -19,15 +20,26 @@

:test {:extra-paths [;; poly modules
"bases/example/test"
"bases/rcf/test"
"components/kaocha-test-runner/test"
"components/kaocha-wrapper/test"
"components/kaocha-wrapper/test-resources"
"components/util/test"
"projects/example/test-resources"]
"projects/example/test-resources"
"projects/rcf/test"
"projects/rcf/test-resources"]
:jvm-opts ["-XX:-OmitStackTraceInFastThrow"
;; Run RCF tests when loading files in REPL
;; https://github.com/hyperfiddle/rcf#ci
"-Dhyperfiddle.rcf.generate-tests=true"]
:extra-deps {lambdaisland/kaocha-cloverage {:mvn/version "1.0.75"}}}

:poly {:main-opts ["-m" "polylith.clj.core.poly-cli.core"]
:extra-paths ["development/poly"]
:jvm-opts ["-XX:-OmitStackTraceInFastThrow"
;; Run RCF tests when loading files in REPL
;; https://github.com/hyperfiddle/rcf#ci
"-Dhyperfiddle.rcf.generate-tests=true"]
:extra-deps {polylith/clj-poly
{:git/url "https://github.com/polyfy/polylith"
:git/sha "ccc261e60f6a875ff30858bf84cf67be105eac6f"
Expand Down
10 changes: 10 additions & 0 deletions projects/rcf/deps.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{:paths []
:deps {poly/rcf {:local/root "../../bases/rcf"}}
:aliases {:test {:extra-paths ["test" "test-resources"]
:extra-deps {polylith-kaocha/kaocha-wrapper {:local/root "../kaocha-wrapper"}

;; kaocha's auto spec test checking needs orchestra and test.check provided
orchestra/orchestra {:mvn/version "2021.01.01-1"}
org.clojure/test.check {:mvn/version "1.1.1"}

lambdaisland/kaocha-cloverage {:mvn/version "1.0.75"}}}}}
10 changes: 10 additions & 0 deletions projects/rcf/test-resources/polylith-kaocha/rcf/tests.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#kaocha/v1
{:num-tests 10000000
:tests [{:id :unit
:test-paths ["test" "src"]
:ns-patterns [".*"]}]
:plugins [:kaocha.plugin/cloverage
:kaocha.plugin.alpha/spec-test-check]
:reporter #profile {:ci kaocha.report/documentation
:default kaocha.report/dots}
:cloverage/opts {:summary? true :html? true :emma-xml? true :codecov? true}}
18 changes: 18 additions & 0 deletions projects/rcf/test/polylith_kaocha/rcf/test_setup.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(ns polylith-kaocha.rcf.test-setup
(:require [hyperfiddle.rcf]
[polylith-kaocha.kaocha-wrapper.config :as config]))

(defn setup
"Enable rcf tests https://github.com/hyperfiddle/rcf#usage"
[project-name]
(println "Setup hyperfiddle.rcf in project" project-name)
(hyperfiddle.rcf/enable!))

(defn post-enhance-config [config opts]
(println "custom post-enhance-config")
(let [{:keys [src-paths test-paths]} opts
opts (assoc opts
:test-paths
(into [] (concat src-paths test-paths)))
new-config (config/default-post-enhance-config config opts)]
new-config))
7 changes: 7 additions & 0 deletions workspace.edn
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
;; must be available on the poly tool's classpath
:polylith-kaocha/runner-opts->kaocha-poly-opts polylith-kaocha.hooks/runner-opts->kaocha-poly-opts}}

"rcf"
{:alias "rcf"
:test {:setup-fn polylith-kaocha.rcf.test-setup/setup
;; must be available on the project's classpath
:polylith-kaocha/config-resource "polylith-kaocha/rcf/tests.edn"
:polylith-kaocha.kaocha-wrapper/post-enhance-config polylith-kaocha.rcf.test-setup/post-enhance-config}}

"kaocha-wrapper"
{:alias "kw"}

Expand Down