This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-22
Channels
- # aws (1)
- # beginners (102)
- # boot (5)
- # cljs-dev (59)
- # cljsjs (1)
- # clojure (154)
- # clojure-australia (1)
- # clojure-brasil (1)
- # clojure-dusseldorf (4)
- # clojure-greece (36)
- # clojure-italy (10)
- # clojure-poland (5)
- # clojure-romania (1)
- # clojure-russia (7)
- # clojure-spec (32)
- # clojure-uk (113)
- # clojure-ukraine (3)
- # clojurescript (107)
- # cursive (13)
- # data-science (25)
- # datomic (23)
- # emacs (3)
- # events (1)
- # fulcro (72)
- # funcool (10)
- # graphql (1)
- # leiningen (1)
- # luminus (2)
- # lumo (38)
- # off-topic (14)
- # onyx (78)
- # planck (4)
- # re-frame (55)
- # reagent (1)
- # ring (3)
- # ring-swagger (2)
- # rum (19)
- # shadow-cljs (89)
- # spacemacs (101)
- # sql (2)
- # unrepl (88)
@mitchelkuijpers what does your :http-handler
do? what kind of assets? css I presume?
(ns dev.test-handler
(:require [ring.middleware.resource :as ring-resource]))
(defn not-found [req]
{:status 404
:headers {"content-type" "text/plain"}
:body "Not found."})
(defn wrap-dir-index [handler]
(fn [req]
(handler
(update-in req [:uri]
#(if (= "/" %) "/index.html" %)))))
(def handler (-> not-found
(ring-resource/wrap-resource "public")
(wrap-dir-index)))
Also pre-compiled js
Cool, I also hadd to add a public dir or it wouldn't start up a http server
test are now queryable at runtime so you can probably build some fancy UIs out of that
Maybe give a test filename regex or something
{:target :browser
:asset-path "/js/test"
:modules {:common {:entries []}
:devcards {:entries [atlas-crm.cards] :depends-on #{:common}}
:test {:entries [atlas-crm.client-test-main] :depends-on #{:common}}}
:output-dir "resources/public/js/test/"
:compiler-options {:devcards true}
:devtools {:http-port 8600
:http-root "public" ;; We don't use this but our handler, but this makes shadow start a http server
:http-handler dev.test-handler/handler
:after-load atlas-crm.client-test-main/client-tests
:preloads [shadow.cljs.devtools.client.hud devtools.preload]}}
shadow-cljs browser-test --test-match some-regexp --port 1234 --handler some.ns/handler --runner atlas-crm.client-test-main
etc
Hmm yes but most probably don't need the handler option
Not really
I’m having a little troubling with shadow and namespaces
I keep getting filename violation statements
For example:
INFO: filename violation for ns paper.components.tooltip, got: cljs/paper/components/tooltip.cljs expected: paper/components/tooltip.cljs (or .cljc)
My shadow-cljs.edn file has :source-paths
set to ["src/cljs"]
@colindresj thats odd, can you run shadow-cljs --cli-info
?
are you using :lein
in your config? when embedding inside boot or lein their classpath will be used and :source-paths
has no effect.
Yeah I am
The lein source path looks like this ["src/cljs" "src/cljc"]
Let me dig around some more, the project.clj source paths vector looked different earlier (and had “src” in it)
Yeah, I keep going back and forth on which organizational style I prefer
Kind of related question: I’m currently using lein: true
because I want to manage my clojure dependencies via project.clj (for cursive support)
Is the lein option a full opt-in, or can I just use lein for dependency management, and shadow for classpath building via the .edn file’s source path vector?
but I could maybe just use it to get the classpath and then add the define :source-paths
you can however also use shadow-cljs pom
to generate a pom.xml
and use that for cursive
Oh sweet, didn’t realize that, will give it a try and see if it works
It’s ok to have a shadow-cljs.edn file that just lists out :lein true
and :builds ...
, nothing else
Right?
as soon as cursive supports the new deps.edn
I’ll add support for that which should remove some of the lein
oddities
Awesome
Thanks for the help
@mitchelkuijpers I’m fighting karma
I don’t really understand what its doing
22 11 2017 19:36:28.744:WARN [web-server]: 404: /js/cljs-runtime/goog.debug.error.js
22 11 2017 19:36:28.744:WARN [web-server]: 404: /js/cljs-runtime/goog.dom.nodetype.js
22 11 2017 19:36:28.745:WARN [web-server]: 404: /js/cljs-runtime/goog.string.string.js
22 11 2017 19:36:28.747:WARN [web-server]: 404: /js/cljs-runtime/goog.asserts.asserts.js
HeadlessChrome 0.0.0 (Mac OS X 10.12.6) LOG: '0 failures, 0 errors.'
22 11 2017 19:47:59.079:WARN [HeadlessChrome 0.0.0 (Mac OS X 10.12.6)]: Disconnected (1 times), because no message in 10000 ms.
HeadlessChrome 0.0.0 (Mac OS X 10.12.6) ERROR
Disconnected, because no message in 10000 ms.
Ah you still need help @thheller
The include stuff is really annoying not sure why it works that way..
:test-dummy
{:target :browser-test
:output-dir "out/demo-test-dummy/public/js"
:devtools
{:http-root "out/demo-test-dummy/public"
:http-port 8606}}
still need a way to filter the namespaces but by default all namespaces that require cljs.test
will be included
It does use cljs.test under the hood
But does it simply inspects all the files?
Yes that is pretty much the only thing
Ahh now I see the browser-test
target.. took me a while. I like that solution ^^
(ns shadow.test.browser
"generic browser test runner"
(:require [shadow.test :as st]
[shadow.dom :as dom]))
;; FIXME: implement custom reporter instead
(defonce log-node (dom/by-id "log"))
(when log-node
(set-print-fn!
(fn [s]
(dom/append log-node (str s "\n")))))
(defn start []
;; (js/console.log "test env" @st/tests-ref)
(st/run-all-tests))
(defn stop [done]
(set! (.-innerText log-node) "")
;; FIXME: determine if async tests are still running
;; and call done after instead
;; otherwise a live reload might interfere with running tests by
;; reloading code in the middle
(done))
;; not sure we need to do something once?
(defn ^:export init []
(start))
Ah cool, if I would build a custom runner then how would I get a hold of all the test namespaces?
With shadow.test somehow?
its all cljs.test
as usual, the only thing I added is that deftest
is registered at runtime
all this info was previously reserved for macro which is why anything involving tests also had to use macros
@mitchelkuijpers https://github.com/thheller/shadow-cljs/issues/57#issuecomment-346464244
Damn thats awesome will def try this out tommorow