                            :red)))
     aggregate))
 
-(defn run-project-tests [& opts]
+(defn run-project-tests
+  "run the tests based on the command line options"
+  [& opts]
   (with-test-classloader
     (bake-ns (:use bake.test clojure.test
                    [clojure.string :only [join]]
                    [bake.core :only [with-context in-project-classloader?]])
              (let [start (System/currentTimeMillis)
                    {:keys [ns-count test-count assertion-count pass-count fail-count error-count]}
-                   (reduce (fn [acc {:keys [ns test-count assertion-count pass-count fail-count error-count]}]
+                   (reduce (fn [acc {:keys [ns test-count assertion-count pass-count fail-count error-count] :as this-all}]
                              (-> acc
                                  (update-in [:ns-count] + 1)
                                  (update-in [:test-count] + test-count)

      (if-let [cause (:cause exec)]
        (#'st/pst-cause-on *out* true cause source-width)))))

(defn report-test [ns test-result]
  (let [[name {:keys [out assertions]}] test-result
        {:keys [pass fail error]} (group-by :type assertions)]
    (when (or out fail error)
      (println)
      (println (ansi/style (str "cake test " ns "/" name) :yellow))
      (when out (print out))
      (when fail (doall (map (partial report-fail name) fail)))
      (when error (doall (map (partial report-error name) error))))))

(defn report-ns [ns results]
  (print (ansi/style (apply str (repeat 40 "-")) :white))
  (println (ansi/style (str"\ncake test " ns) :cyan))
  (doseq [test-result (doall (:tests results))]
    (report-test ns test-result))
  (let [{:keys [fail-count pass-count error-count assertion-count test-count] :as aggregate}
        (reduce (fn [acc [name {:keys [assertions]}]]
                  (let [acc (update-in acc [:test-count] inc)]
                    (let [grouped (group-by :type assertions)
                          fail-count (count (:fail grouped))
                          pass-count (count (:pass grouped))
                          error-count (count (:error grouped))]
                      (-> acc
                          (update-in [:fail-count] + fail-count)
                          (update-in [:pass-count] + pass-count)
                          (update-in [:error-count] + error-count)
                          (update-in [:assertion-count] + fail-count pass-count error-count)))))
                {:ns ns, :test-count 0, :assertion-count 0, :pass-count 0, :fail-count 0, :error-count 0}
                (:tests results))]
    (println (format "\nRan %s tests containing %s assertions."

                            actual)))
      form)))

(defn test-opts
  "figure out whichs tests to run based on cake's command line options"
  []
  (let [args (into (:test *opts*) (:autotest *opts*))]
    (merge {:tags #{} :functions #{} :namespaces #{}}
           (if (empty? args)
