Open
Description
Not an issue but a suggestion.
Exercism Clojure track tests have metadata :task attached with values from 1 to n, each representing a task in the exercise. While working through tasks sequentially, I prefer running tests specific to the current task. Running these tests using :only (like lein test :only ns/test_function
) is tedious since I must execute each test individually. I wanted a way to run all tests associated with a task at once.
After studying how test selectors work, I added a test-selector in project.clj. Now I can run all tests for a specific task—for example, task 2 —using lein test :task 2
Add the :task test-selector in any project that has tests defined with ^{:task 1} type markers.
I hope you find it useful.
(defproject annalyns-infiltration "0.1.0-SNAPSHOT"
:description "annalyns-infiltration exercise."
:url "https://github.com/exercism/clojure/tree/main/exercises/concept/annalyns-infiltration"
:dependencies [[org.clojure/clojure "1.11.1"]]
:test-selectors {;; Selects all tests with the :task metadata key matching the given value.
;; usage
;; lein test :task n ;; where n is the task number
:task (fn [m task]
(when-let [task-value (get m :task)]
(= task task-value)))})
Metadata
Metadata
Assignees
Labels
No labels
Activity