|
253 | 253 | t threads NUMBER int "The maximum number of threads to spawn during the tests." |
254 | 254 | n namespaces NAMESPACE #{sym} "The set of namespace symbols to run tests in." |
255 | 255 | e exclusions NAMESPACE #{sym} "The set of namespace symbols to be excluded from test."] |
256 | | - (let [commands (cond |
257 | | - commands commands |
258 | | - :default (->> (or (seq namespaces) (all-ns)) |
259 | | - (remove (or exclusions #{}) ) |
260 | | - (namespaces->vars test-me-pred) |
261 | | - (map var->command)))] |
262 | | - (if (seq commands) |
263 | | - (do (assert (every? string? commands) |
264 | | - (format "commands must be strings, got %s" commands)) |
265 | | - (binding [parallel/*parallel-hooks* {:init init-sync-map |
266 | | - :task-init task-sync-map}] |
267 | | - (parallel/runcommands :commands commands |
268 | | - :batches threads))) |
269 | | - (do (util/warn "No namespace was tested.") |
270 | | - identity)))) |
| 256 | + (assert (every? string? commands) (format "commands must be strings, got %s" commands)) |
| 257 | + (let [cmd-atom (atom commands)] |
| 258 | + (comp (core/with-pass-thru _ |
| 259 | + (reset! cmd-atom (->> (or (seq namespaces) (all-ns)) |
| 260 | + (remove (or exclusions #{})) |
| 261 | + (namespaces->vars test-me-pred) |
| 262 | + (map var->command) |
| 263 | + (into #{})))) |
| 264 | + (core/with-pre-wrap fileset |
| 265 | + (binding [parallel/*parallel-hooks* {:init init-sync-map |
| 266 | + :batch-init identity |
| 267 | + :task-init task-sync-map}] |
| 268 | + (if-let [commands (seq @cmd-atom)] |
| 269 | + (let [middleware (parallel/runcommands :commands commands |
| 270 | + :batches threads)] |
| 271 | + ;; Forcing execution of runcommands inside this task |
| 272 | + ((middleware identity) fileset)) |
| 273 | + (do (util/warn "No namespace was tested. Try to require your test namespaces before calling boot.test/runtests.\n") |
| 274 | + fileset))))))) |
271 | 275 |
|
272 | 276 | (comment |
273 | 277 | (reset! util/*verbosity* 2) |
|
281 | 285 | "boot.task.built-in-test/sift-to-asset-invert-tests" |
282 | 286 | "boot.task.built-in-test/sift-include-tests"}) |
283 | 287 | (test-report) |
284 | | - (test-exit))) |
285 | | - ) |
| 288 | + (test-exit)))) |
0 commit comments