 (defn run-tests
   ([build-output]
    (run-tests build-output nil))
-  ([{:keys [js js-directory]} {:keys [headless? no-sandbox? screenshot-video? framerate
+  ([{:keys [js js-directory]} {:keys [headless? no-sandbox?
+                                      screenshot-video? framerate loop-video?
                                       ring-handler]}]
    (log "Run compiled js test file:" js)
    (let [chrome-fixture (create-chrome-fixture {:headless? (if (some? headless?)

       :private true}
  final-test-report-pattern #"(\d+) failures, (\d+) errors.")

(defn- assert-test-result [msg]
  (let [[match errors failures] (re-matches final-test-report-pattern msg)]
    (when match
      (assert (= "0" errors failures)
              "ClojureScript tests had failures or errors, see previous output for details.")
      true)))

(defn- poll-test-execution []
  (loop [started? false

      (when video-name
        (let [input (str video-name "-%d.png")
              output (str video-name ".png")
              cmd ["ffmpeg"
                   "-framerate" (str framerate)
                   "-y" "-i" input "-f" "apng"
                   "-plays" (if loop-video? "0" "1")
                   output]]
          (println "Generate video " output)
          (let [{exit :exit err :err} (apply sh/sh cmd)]
            (if (zero? exit)
