           difference (replace-suffix expected "difference")
           result     (compare-images expected actual difference)
           threshold  0.02]
-      (when (<= result threshold)
-        (io/delete-file (io/file actual))
-        (io/delete-file (io/file difference)))
-      (t/is (<= result threshold)))))
+      (when (number? result)
+        (when (<= result threshold)
+          (io/delete-file (io/file actual))
+          (io/delete-file (io/file difference)))
+        (t/is (<= result threshold))))))
 
 (defn run-snippet-as-test [{:keys [ns name opts setup body body-str mouse-clicked]}]
   (let [result (promise)

            (etaoin/refresh driver)
            (etaoin/screenshot-element driver {:tag :canvas} actual)
            (let [result (compare-images expected actual difference)]
              (when (<= result threshold)
                (io/delete-file (io/file actual))
                (io/delete-file (io/file difference)))
              (t/is (<= result threshold)
                    (str "Image comparison for " name " not within acceptable threshold: " threshold)))))))
    (etaoin/quit driver)))

             (try
               (q/background 255)
               (body)
                 (assert-unchanged-snippet-output name)
               (catch Exception e
                 (println "Error" e)
                 (.printStackTrace e)
