Fork me on GitHub
#shadow-cljs
<
2022-11-29
>
Joni13:11:49

Hey I’m having a weird issue running karma tests with a shadow-cljs project in github actions and wondering if anyone here has ran in to the same issue. Currently if I initialise my app locally from scratch and run npm install and npx shadow-cljs compile app and npx karma start --single-run the tests fail preceded by warnings of Use of undeclared Var cljs.test/test-var . But if the compile app is ran twice the test succeeds which is really strange to me. turns out we had used require-macros instead of :require for cljs.test in the test namespace. This was just a really weird interaction that took way too long to debug 😄

p-himik21:11:44

Seeing some very interesting behavior with shadow-cljs 2.20.12 and @material-ui/[email protected]. Both of these items work just fine in :require:

["@material-ui/core/Button" :default Button]
["@material-ui/core/Button$default" :as Button]
But if I replace Button with Box, only the first import will work. Or rather, the component itself will work. The second import will produce cljs.core/Box instead of that MUI Box.

p-himik21:11:52

If I import ["@material-ui/core/Box" :default Box] then Box becomes what I expect it to be. If I import ["@material-ui/core/Box$default" :as Box] then Box is cljs.core/Box.

p-himik21:11:02

Adding Box to :refer-clojure :exclude seems to fix it. But there's also no warning about Box shadowing if I don't do that.

p-himik21:11:45

So it's as if ["@material-ui/core/Box$default" :as Box] is completely ignored because there's already cljs.core/Box. Still weird though that there's no warning for ["@material-ui/core/Box" :default Box] even though it properly shadows cljs.core/Box.

thheller21:11:19

ah hmm. might be a ordering issue where :as alias are checked "too late"

thheller21:11:23

since they are normally not callable