shadow-cljs

eraserhd 2025-12-21T19:48:41.835459Z

The answer seems to be that I needed to delete .shadow-cljs as something was stuck in the cache.

eraserhd 2025-12-21T19:52:59.199389Z

However, now I have the problem that my test-runner ns "start" is not called before the tests are run on the first page reload? If any files are updated, it is called before rerunning the tests. The namespace is loaded, so I was able to put (clojure.spec.alpha/check-asserts true) at the top-level, just not in start.

thheller 2025-12-21T20:07:04.404259Z

init is called and it should call start if you want, see https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/test/browser.cljs#L21-L23

eraserhd 2025-12-21T20:10:18.912379Z

Ah... I was trying not to copy-pasta and did (def init shadow.test.browser/init)...

thheller 2025-12-21T20:12:04.034559Z

why are you creating your own runner ns if you are just calling the original?

eraserhd 2025-12-21T20:13:12.192429Z

I want to enable clojure spec asserts before running the tests. That's the only reason.

eraserhd 2025-12-21T20:40:34.953089Z

For reference, I think this is the cleanest thing that works:

(ns cadro.test-runner
  "Override of shadow's test runner just to enable spec check-asserts."
  {:dev/always true}
  (:require
   [clojure.spec.alpha :as s]
   [shadow.test.browser :as sb]))

(def start sb/start)
(def stop sb/stop)
(defn ^:export init []
  (s/check-asserts true)
  (sb/init))

thheller 2025-12-21T20:41:20.864219Z

you should really just copy the one that exists and adjust it. its tiny and there is a macro issue with the test data

thheller 2025-12-21T20:42:26.506759Z

this bit could potentially be a problem because its a weird macro

eraserhd 2025-12-21T20:43:33.307189Z

hrmm... ok