Skip to content

Commit 6f320a6

Browse files
committed
test: add report
Print out each test name with platform Extra feedback is nice and this helps to quickly see that we are running on the platform we intended.
1 parent 3ae1c29 commit 6f320a6

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

test/babashka/cli/exec_test.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{:org.babashka/cli {:exec-args {:foo :bar}}}
33
(:require
44
[babashka.cli-test :refer [submap?]]
5+
[babashka.cli.test-report]
56
[babashka.cli.exec :refer [main]]
67
[babashka.fs :as fs]
78
[clojure.edn :as edn]

test/babashka/cli/test_report.cljc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(ns babashka.cli.test-report
2+
(:require [clojure.test :as test]))
3+
4+
(def platform
5+
#?(:bb (str "bb " (System/getProperty "babashka.version"))
6+
:cljs (str "cljs " *clojurescript-version*)
7+
:clj (str "jdk " (System/getProperty "java.version") " clj " (clojure-version))))
8+
9+
(defmethod test/report
10+
#?@(:cljs [[:cljs.test/default :begin-test-var]]
11+
:default [:begin-test-var]) [m]
12+
(let [test-name (-> m :var meta :name)
13+
line (str "=== " test-name " [" platform "]")]
14+
#?(:cljs (js/process.stdout.write (str line "\n"))
15+
:default (println line))))

test/babashka/cli_test.cljc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
(ns babashka.cli-test
22
(:require
33
[babashka.cli :as cli]
4+
[babashka.cli.test-report]
45
[clojure.string :as str]
56
[clojure.test :refer [deftest is testing]]
67
[borkdude.deflet :as d]

0 commit comments

Comments
 (0)