浏览代码

Fix intermittent test-data staleness for test runner

Gabriel Horner 3 年之前
父节点
当前提交
12712f83f1
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      src/test/frontend/test_runner.cljs

+ 8 - 1
src/test/frontend/test_runner.cljs

@@ -5,6 +5,7 @@
   This gives the user a fair amount of control over which tests and namespaces
   This gives the user a fair amount of control over which tests and namespaces
   to call from the commandline. Once this test runner is stable enough we should
   to call from the commandline. Once this test runner is stable enough we should
   contribute it upstream"
   contribute it upstream"
+  {:dev/always true} ;; necessary for test-data freshness
   (:require [shadow.test.env :as env]
   (:require [shadow.test.env :as env]
             [clojure.tools.cli :as cli]
             [clojure.tools.cli :as cli]
             [shadow.test.node :as node]
             [shadow.test.node :as node]
@@ -72,9 +73,15 @@ returns run options for selected tests to run"
    ["-r" "--namespace-regex REGEX"
    ["-r" "--namespace-regex REGEX"
     :parse-fn re-pattern :desc "Regex for namespaces to test"]])
     :parse-fn re-pattern :desc "Regex for namespaces to test"]])
 
 
+;; Necessary to have test-data in this ns for freshness. Relying on
+;; node/reset-test-data! was buggy
+(defn ^:dev/after-load reset-test-data! []
+  (-> (env/get-test-data)
+      (env/reset-test-data!)))
+
 (defn main [& args]
 (defn main [& args]
   ;; Load test data as is done with shadow.test.node/main
   ;; Load test data as is done with shadow.test.node/main
-  (node/reset-test-data!)
+  (reset-test-data!)
 
 
   (let [{:keys [options summary]} (parse-options args cli-options)]
   (let [{:keys [options summary]} (parse-options args cli-options)]
     (if (:help options)
     (if (:help options)