This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-17
Channels
- # babashka (4)
- # beginners (161)
- # calva (19)
- # cider (13)
- # circleci (16)
- # clj-kondo (7)
- # cljs-dev (3)
- # cljsrn (46)
- # clojure (105)
- # clojure-australia (2)
- # clojure-nl (15)
- # clojurescript (20)
- # conjure (14)
- # core-async (8)
- # cursive (3)
- # datomic (4)
- # figwheel (5)
- # fulcro (22)
- # graalvm (1)
- # hoplon (2)
- # kaocha (3)
- # leiningen (6)
- # malli (5)
- # off-topic (19)
- # re-frame (5)
- # reagent (1)
- # reitit (43)
- # releases (1)
- # reveal (14)
- # rewrite-clj (2)
- # rum (1)
- # shadow-cljs (31)
- # spacemacs (2)
- # sql (6)
- # xtdb (8)
has anyone used react native testing library with shadow-cljs?
How did you integrate the tests?
I would like to import js-notications, the exact syntax is not in shadow-cljs doc
import ToastManager from 'js-notifications';
const toastManager = new ToastManager();
(:require ["js-notifications" :refer (ToastManager)] )
(.ToastManager. {}) -> module$node_modules$js_notifications$dist$ToastManager.ToastManager is not a constructorthe exact syntax is in the docs, see the translation table https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages
The exact pattern is not in the docs. I tried them all, but after lunch I might found the solution, it looks promising - no errors (It is not logical to me at all)
import ToastManager from 'js-notifications';
->
["js-notifications" :default ToastManager]
this "default" is confusing to me. When npm exports some objects, is there one default? or defaultExport is just a name and :default just picks an object from map of all exported objects?
import defaultExport from "module-name";
it is right there in the first example đ
Iâm getting the following error when running shadow watch
Invalid configuration -- Spec failed --------------------  {:target ...,   :output-dir ...,   :entries [],       ^^   :build-id ...} should satisfy  (<= 1 (count %) Integer/MAX_VALUE) -- Relevant specs ------- :shadow.build.targets.npm-module/entries:  (clojure.spec.alpha/coll-of   clojure.core/simple-symbol?   :distinct   true   :min-count   1   :kind   clojure.core/vector?) :shadow.build.targets.npm-module/target:  (clojure.spec.alpha/keys   :req-un   [:shadow.build.targets.shared/output-dir   :shadow.build.targets.npm-module/entries]   :opt-un   [:shadow.build.targets.npm-module/runtime   :shadow.build.targets.shared/devtools]) :shadow.build.config/build+target:  (clojure.spec.alpha/and   :shadow.build.config/build   (clojure.spec.alpha/multi-spec   shadow.build.config/target-spec   :target)) ------------------------- Detected 1 error
{:deps true :source-paths [âsrcâ] :dependencies [[reagent â0.10.0"] [re-frame â0.12.0â] [re-frame-steroid â0.1.1"] [rn-shadow-steroid â0.2.1â] [re-frisk-remote â1.3.3"] [cljs-ajax/cljs-ajax â0.8.1â] [day8.re-frame/http-fx â0.2.2"]] :builds {:test {:target :npm-module :output-dir âtest-outâ :entries []} :dev {:target :react-native :init-fn humboi.core/init :output-dir âappâ :compiler-options {:closure-defines {âre_frame.trace.trace_enabled_QMARK_â true}} :devtools {:after-load steroid.rn.core/reload :build-notify steroid.rn.core/build-notify :preloads [re-frisk-remote.preload]}}}}
iâm running the command shadow-cljs watch test
the error tells you that :entries []
is not valid and requires at least one namespace
I put in a namespace myapp.core-test but it says that the namespace wasnât found
not available
I expect that the namespace would be available
since the namespace is defined in one of the files in the source-paths
the source path is âtestâ
and the file with this namespace is found in the path ./test/myapp
Iâve added test in :source-paths in deps.edn
What about clj->js? I was quite naive, that the npm import has magic powers and will also convert clojure stuctures to js. But I found that this is not the case and clj->js is still a must, It would be great id clj-kondo would be able to recognize cases like that. I spent at least an hour before I find out that my options are silently ignored without conversion. (def tm (ToastManager. (clj->js {:container log-container, :seconds 300})))
@jj974 this is impossible to know for clj-kondo I think, which JS libs accept data CLJS structures and which do not (even if most of them don't)
@U04V15CAJ clj-kondo is great. I cleaned up my old project. Learned a few things, misplaced doc strings, way too many times.