-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathbb.edn
More file actions
75 lines (72 loc) · 3.27 KB
/
bb.edn
File metadata and controls
75 lines (72 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{:min-bb-version "1.12.210"
:paths ["bb"]
:tasks
{:init (defn banner
[message]
(let [stars (clojure.string/join (repeat 70 "*"))
padding-len (- 70 (count message) 5)
spaces (clojure.string/join (repeat padding-len " "))]
(println stars)
(println "*" message spaces "*")
(println stars)))
test-jvm {:doc "Runs tests in JVM"
:task (do
(banner "Running JVM Tests")
(shell "lein test"))}
test-bb {:doc "Runs tests in Babashka"
:extra-deps {io.github.cognitect-labs/test-runner
{:git/tag "v0.5.1" :git/sha "dfb30dd"}}
:extra-paths ["test"]
:task (do
(banner "Running Babashka Tests")
(exec 'cognitect.test-runner.api/test))
:exec-args {:patterns [".*"]}}
test-cljs {:doc "Runs tests in ClojureScript"
:task (do
(banner "Running CLJS Tests")
(shell "npx shadow-cljs compile test"))}
test-lpy {:doc "Run tests in Basilisp"
:task (do
(banner "Running Basilisp Tests")
(shell
{:extra-env {"BASILISP_TEST_PATH" "./test"
"BASILISP_TEST_FILE_PATTERN" ".*\\.(lpy|cljc)"}}
"basilisp test -p test -- -n auto"))}
test-all {:doc "Run tests under all dialects"
:task (do
(run 'test-jvm)
(run 'test-cljs)
(run 'test-bb)
(run 'test-lpy))}
test {:doc "Runs tests in multiple named dialects: jvm, bb, cljs, or lpy"
:task (letfn [(help []
(println "Usage: bb test <dialect1> [<dialect2>]...")
(println "Where <dialect> is one of:")
(println " jvm Runs tests in Clojure JVM")
(println " cljs Runs tests in ClojureScript")
(println " bb Runs tests in Babashka")
(println " lpy Runs tests in Basilisp")
(println " all Runs tests in all supported dialects")
(println "Tests are run in the order given."))]
(let [valid #{"jvm" "cljs" "bb" "lpy" "all"}
unknown (remove valid *command-line-args*)]
(cond
(not (some? (seq *command-line-args*)))
(do
(help))
(some? (seq unknown))
(do
(println "Unknown dialect name(s):" (clojure.string/join ", " unknown))
(help))
(some? (seq (some #{"all"} *command-line-args*)))
(run 'test-all)
:else
(doseq [dialect (seq *command-line-args*)]
(case dialect
"jvm" (run 'test-jvm)
"cljs" (run 'test-cljs)
"bb" (run 'test-bb)
"lpy" (run 'test-lpy))))))}
new-test {:doc "Creates new test for the Clojure symbols named by <args>. Unqualified symbols assume clojure.core"
:requires ([new-test])
:task (new-test/new-test *command-line-args*)}}}