This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-19
Channels
- # adventofcode (7)
- # aws (6)
- # babashka (7)
- # beginners (200)
- # calva (49)
- # chlorine-clover (3)
- # cider (24)
- # clj-kondo (115)
- # cljs-dev (5)
- # cljsrn (16)
- # clojure (44)
- # clojure-australia (9)
- # clojure-czech (1)
- # clojure-dev (1)
- # clojure-europe (63)
- # clojure-france (6)
- # clojure-losangeles (1)
- # clojure-nl (2)
- # clojure-spec (27)
- # clojure-uk (77)
- # clojurescript (45)
- # clojurewerkz (3)
- # conjure (5)
- # cryogen (1)
- # cursive (2)
- # datahike (6)
- # datascript (3)
- # datomic (18)
- # fulcro (5)
- # graalvm (55)
- # jobs (3)
- # luminus (4)
- # malli (1)
- # pathom (1)
- # reagent (16)
- # shadow-cljs (67)
- # spacemacs (18)
- # sql (57)
- # testing (6)
- # tools-deps (9)
and when run npx shadow-cljs compile app, it errs: The required namespace “cljsjs.react-input-autosize” is not available, it was required by “understanding_re_frame/hiccup.cljs”
However, I do see a ~/.m2/repository/cljsjs/react-input-autosize/2.2.1-1/react-input-autosize-2.2.1-1.jar file
> shadow-cljs does not support CLJSJS at all to avoid conflicts in your code https://shadow-cljs.github.io/docs/UsersGuide.html#_why_not_use_cljsjs
Does shadow support this? http://clojurescriptmadeeasy.com/blog/refactoring-with-deprecation.html
@schpaencoder in the latest version you can set :devtools {:ignore-warnings true}
so this doesn't blow stuff up
https://github.com/clojure/clojurescript/commit/3ea593825f60c228f6a384be52bcf2fc4e417567
The problem is I don’t want to turn off warnings, but shadow complains about deprecations
unless you still want to see it but not prevent hot reload and stuff. for that you can set :devtools {:ignore-warnings true}
hello, everybody! I am relatively not new to clojureScript, but I am new to shadow-cljs, in particular how to configure testing properly. i have a 100% shadow-cljs project and I am struggling with the :node-test and :browser-test setups as they do not give me the desired output. Can maybe somebody give me an example of a project with shadow-cljs with properly configured testing? thank you in advance
Isn’t shadow supposed to automatically download the dependency? When I add https://github.com/day8/re-frame-10x as the project dependency, it errs: The required JS dependency “react-highlight.js” is not available, it was required by “day8/re_frame_10x/view/components.cljs”.
@marharyta.obraztsova what is the "desired output"?
So, I am currently configuring :browser-test and the way I understand it (correct me if I am wrong) that this is the best way to set up testing for atoms and re-agent components
hmm not a clue about that. that display is from https://github.com/bhauman/cljs-test-display
... I seem to need it in my code to display the tests in the viasual way in the browser anyways
test.cljs
(ns mytherapy.test
(:require [cljs.test :refer (deftest is use-fixtures)]
[shadow.dom :as dom]
[shadow.test :as st]
[cljs-test-display.core :as ctd]
["react-testing-library" :as rtl]
[cljs-time.core :as time]
[mytherapy.state-utils :refer [state-app make-note]]
))
;;
(use-fixtures :each
{:after rtl/cleanup})
(def test-state {:notes []
:records []
:data []
:currentNote {}})
(deftest a-failing-test
(is (= 2 2)))
(deftest a-failing-test-6
(is (= 9 2)))
(deftest test-make-note
(is (= (make-note "uhihy" "hello" "20210119T164619") {:note_id "uhihy"
:note_title "hello"
:note_type "note"
:timestamp_created "20210119T164619"
:timestamp_edited "20210119T164619"})))
(defn start []
(st/run-all-tests (ctd/init! "test-root"))
(a-failing-test)
(a-failing-test-6)
(test-make-note))
(defn stop[done]
; tests can be async. You must call done so that the runner knows you actually finished
(done))
(defn ^:export init[]
(dom/append [:div#test-root])
(start))
(ns mytherapy.test
(:require [cljs.test :refer (deftest is use-fixtures)]
[shadow.dom :as dom]
[shadow.test :as st]
[cljs-test-display.core :as ctd]
["react-testing-library" :as rtl]
[cljs-time.core :as time]
[mytherapy.state-utils :refer [state-app make-note]]
))
;;
(use-fixtures :each
{:after rtl/cleanup})
(def test-state {:notes []
:records []
:data []
:currentNote {}})
(deftest a-failing-test
(is (= 2 2)))
(deftest a-failing-test-6
(is (= 9 2)))
(deftest test-make-note
(is (= (make-note "uhihy" "hello" "20210119T164619") {:note_id "uhihy"
:note_title "hello"
:note_type "note"
:timestamp_created "20210119T164619"
:timestamp_edited "20210119T164619"})))
(defn start []
(a-failing-test)
(a-failing-test-6)
(test-make-note))
(defn stop[done]
; tests can be async. You must call done so that the runner knows you actually finished
(done))
(defn ^:export init[]
(start))
nothing related to runner stuff. that is completely optional. I guess the docs should make that clearer.
{...
:builds
{:test
{:target :browser-test
:test-dir "test-out"
:ns-regexp "-test$"
:devtools {:http-port 8021
:http-root "test-out"}}}}
try this. just in case there are files or whatever in the old :test-dir
interfering with stuff
note that the test ns likely needs to be changed as the regexp above is for files ending in -test
so mytherapy.test
wouldn't match that
Thanks a lot @U05224H0W!