 (defn test-ns-hook
   []
   (is (-> (capture-test-var #'default-trial-counts)
+          second
           read-string
           :num-tests
           (= ct/*default-test-count*)))
 
   (is (-> (capture-test-var #'trial-counts)
+          second
           read-string
           (select-keys [:test-var :result :num-tests])
           (= {:test-var "trial-counts", :result true, :num-tests 5000})))
 
   (binding [ct/*report-trials* true]
-    (let [output (capture-test-var #'trial-counts)]
+    (let [output (second (capture-test-var #'trial-counts))]
       (is (re-matches #?(:clj  (java.util.regex.Pattern/compile "(?s)\\.{5}.+")
                          :cljs #"\.{5}[\s\S]+")
                       output))))

          "calling with other :type keeps last-trial-report constant")
      (is (re-seq
           #"(Passing trial \d{3} / 1000 for .+\n)+"
           (capture-test-var #'long-running-spec)))
      (is (> @last-trial-report trial-report-1)
          "running the test makes last-trial-report to increment")))

  (let [[report-counters stdout]
        #?(:clj
           (binding [ct/*report-shrinking* true
                     ;; need to keep the failure of this-is-supposed-to-fail from
                     ;; affecting the clojure.test.check test run
                     *report-counters* (ref *initial-report-counters*)]
             (let [out (capture-test-var #'this-is-supposed-to-fail)]
               [@*report-counters* out]))

           :cljs
           (binding [ct/*report-shrinking* true]
             ;; need to keep the failure of this-is-supposed-to-fail from
             ;; affecting the clojure.test.check test run
             (let [restore-env    (test/get-current-env)
                   _              (test/set-env! (test/empty-env))
                   report-str     (capture-test-var #'this-is-supposed-to-fail)
                   env            (test/get-current-env)]
               (test/set-env! restore-env)
               [(:report-counters env) report-str])))]
    (is (== 1 (:fail report-counters)))
    (is (re-seq
         #?(:clj


(defspec this-is-supposed-to-fail 100 vector-elements-are-unique)

(defspec this-throws-an-exception
  (prop/for-all [x gen/nat]
    (throw (ex-info "this property is terrible" {}))))

(defn ^:private capture-test-var
  "Returns [report-counters out-str]."
  [v]
  #?(:clj
     (binding [*report-counters* (ref *initial-report-counters*)]
       (let [out (with-out-str (binding [*test-out* *out*] (test-var v)))]
         [@*report-counters* out]))

     :cljs
     (let [restore-env    (test/get-current-env)
           _              (test/set-env! (test/empty-env))
           out            (with-out-str (test-var v))
           env            (test/get-current-env)]
       (test/set-env! restore-env)
       [(:report-counters env) out])))

(defn ^:private capture-clojure-test-reports
  [func]
