This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-18
Channels
- # 100-days-of-code (10)
- # announcements (2)
- # aws (3)
- # beginners (120)
- # boot (6)
- # calva (6)
- # cider (22)
- # cljsrn (3)
- # clojure (145)
- # clojure-greece (1)
- # clojure-italy (7)
- # clojure-nl (24)
- # clojure-russia (90)
- # clojure-spec (21)
- # clojure-uk (80)
- # clojurescript (175)
- # core-async (1)
- # datomic (17)
- # emacs (8)
- # ethereum (5)
- # figwheel (1)
- # figwheel-main (140)
- # fulcro (137)
- # jobs (6)
- # jobs-discuss (3)
- # luminus (3)
- # mount (1)
- # nyc (3)
- # off-topic (39)
- # onyx (1)
- # pedestal (1)
- # re-frame (21)
- # reagent (13)
- # shadow-cljs (60)
- # spacemacs (25)
- # test-check (4)
- # tools-deps (14)
- # uncomplicate (3)
- # vim (18)
@dpsutton nRepl should write an port file in the current folder and Cursive should be able to connect to it when selecting the Lein REPL option - see here: https://andrearichiardi.com/blog/posts/clojurescript-cursive-shadow-setup.html
If there is no file maybe he's got an old version
It might depend on how clj or figwheel launch nRepl actually. Haven't explored that part
Figwheel should work with Node.js just fine, right? I'm getting these errors after migrating to figwheel.main
[nodejs:out] [goog.net.WebSocket] Opening the WebSocket on
[nodejs:out] [goog.net.WebSocket] The WebSocket on closed.
[nodejs:out] [ 2.952s] [goog.net.WebSocket] The WebSocket on closed.
[nodejs:out] [goog.net.WebSocket] Seconds until next reconnect attempt: 1
[nodejs:out] [ 2.953s] [goog.net.WebSocket] Seconds until next reconnect attempt: 1
[nodejs:out] [goog.net.WebSocket] Opening the WebSocket on
[nodejs] Exited with error code 1.
[nodejs:err] [goog.net.WebSocket] An error occurred: undefined
[nodejs:err] [ 2.950s] [goog.net.WebSocket] An error occurred: undefined
[nodejs:err] [goog.net.WebSocket] The WebSocket disconnected unexpectedly: undefined
[nodejs:err] [ 2.953s] [goog.net.WebSocket] The WebSocket disconnected unexpectedly: undefined
has anyone had success to run :nodejs extra-main on browser project? I can't mix the two with extra-main
@U051GJCF0 yeah that probably won’t work
that's also the conclusion I came to eventually, but hoped there's some magic...anyway, thanks, happy nonetheless
@U051GJCF0 I’m just about to get this to work 🙂
I have questions about testing. It could also help to provide more info to https://figwheel.org/docs/testing.html
- (run-tests-async 10000)
- what if one of tests will take 15 sec.? Will it fail or success?
- It works without defmethod report [:cljs.test/default :end-run-tests] [test-data]
. It makes me confuse. Do I need declare this method or not? If not so what is the point of declaring this method?
ok I think I can answer myself from the source code: - it is timeout so it will fail after 10 sec.
clj -A:fig -m figwheel.main -m form-validator.test-runner
open web browser window. What I miss? It shouldn’t happen. At least as I understand doc https://figwheel.org/docs/testing.html#running-tests-from-the-command-line
^{:watch-dirs ["src" "admin-src"]
:css-dirs ["resources/public/css"]}
{:main example.core}
Why :main is in separated map? What are other parameters besides of :main in this second map?Hmm or maybe this part of the doc doesn’t mean tests are run in console. Still web browser is needed. > Running tests from the command line This could explain my confusion
so… figwheel-main has no functionality to run tests in console without web browser. Am I right?
I should use https://github.com/Olical/cljs-test-runner instead
@kwladyka https://figwheel.org/docs/testing.html#running-tests-in-a-headless-environment
folks are making a lot of assumptions about testing, I’m going to need to clarify the document
test-runner
(ns form-validator.test-runner
(:require [form-validator.core-test]))
It is whole code to run tests, no more needed, even 1 extra line (body). It detects things by automate.so that is why I am asking about fighweel-main, beucase it is important for CI purpose
I mean `:launch-js [“/Applications/Google Chrome.app/Contents/MacOS/Google Chrome” “--headless” “--disable-gpu” “--repl” :open-url]` this part sounds like a lot of troubles
I would agree if you say “it is ok if this isn’t easy for you”, but with simple I would argue 🙂
@bhauman thanks for all the work on figwheel.main, this time around we managed to migrate from sidecar pretty smoothly
As I understand it needs to know a path to the chrome. On each system it can be different path. I don’t feel it. Just I would like to see common configuration for that purpose. *that - run tests in console on each developers computer and CI servers without issues
I did run into [Figwheel:SEVERE] clojure.lang.ExceptionInfo: Circular dependency between foo.bar and foo.bar
in a case where a .cljs
namespace was loading macros from a .clj
namespace with the same name
@kwladyka I think I’ll just have to say that this is as far as figwheel has made it into the testing space
@bhauman your work is great. I am saying that, because I want to learn how to use your tool in right way. Only one purpose. Maybe give feedback also. I hope you appreciate it.
when using :extra-main-files
for devcards, do you still need :devcards true
somewhere?
@kwladyka I don’t have instructions available for running automated tests on the command line yet
right... so currently we have our defcard
's in the same namespaces as components, but I guess we should split those out
@kwladyka you would add the :launch-js
to a test.cljs.edn and then you would run clj -m figwheel.main -b test -r
for automated tests
@bhauman great, so it will be update 🙂 I will wait for the doc 🙂 I can’t figure out myself how to do re-run with watch and CI run without knowing path to chrome.
will keep you posted as we start using it. So far the only thing that I've missed is a way to wrap the build-fn
, worked around that by doing an alter-var-root
on figwheel.main/fig-core-build
we have five builds running at the same time, and we have some extra logic to skip rebuilds if the changed files aren't depended on by the build's :main
namespace
the pre
and post
hooks are handy, there was something else we were using the build-fn for that I managed to do with a post hook, but for this use case you really need the build-fn
@plexus also, is it possible to use extra-mains to eliminate some or all of these builds?
because there is nothing wrong with having all the code being shared during development
one targets node, so that one's out. One is a webworker, not sure if that changes things? One is for devcards, still need to figure out how to get the devcards UI in one main but not the other, and the final one has a custom :on-jsload
, not sure yet how to deal with that.
with extra mains all the reloads will fire if they are present in the environment, so you will want to make them conditional
I think node compilation does output some rare things differently in the output namespaces
[Figwheel] Compile Warning journal/src/editor/components/ui/autocompleter.cljs line:250 column:1
Use of undeclared Var devcards.core/register-card
245 {:label "List" :value :list}
246 {:label "Code Listing" :value :code-listing}
247 {:label "Formula" :value :formula}
248 {:label "Image" :value :image}])
249
250 (defcard-rg autcompleter-dropdown
^---
251 (let [open? (reagent/atom false)
252 selected-value (reagent/atom :paragraph)]
253 (fn []
254 [:button.nj-button--primary.flex.items-center.mr2
255 {:on-click #(reset! open? true)
getting NS_BINDING_ABORTED:
on the webworker... I think this might not work with the extra mains
New release of cljs-spa-example featuring simplified global exports configuration and automatic headless testing: https://github.com/pesterhazy/cljs-spa-example
@pesterhazy I’d move some of the config parameters out of figwheel-main.edn to dev.cljs.edn
Good point
@bhauman i've made some progress with "fig:test" in my actual client environment 1. By adding "target" to the resource-paths then should-add-temp-dir? is false (and then ouput-dir is not changed. 2. In this environment adding "/test.html" just didn't work (even with a resources/public/test.html file in place) so in test.cljs.edn I left :open-url "http://[[server-hostname]]:[[server-port]]" 3. I can use a shell script (instead of a hardcoded pathname) to invoke the proper executable of Chrome based on the platform (e.g. Mac for devs, Linux for CI). The key thing to remember is it's really important to NOT pollute STDOUT (as the test may misinterpret garbage) and I have the script exec the chrome binary. In this way I no longer have to worry about saving the PID and killing the headless browser as it seems to quit properly (presumably via "quit" in the test session?)
That being said.. it seems like changing :output-dir and/or :output-to in test.cljs.edn causes the interactive (pipe) session to the headless chrome to not work correctly (so I make sure neither of those are set and just accept the defaults).
I wonder if anyone has tried to set :output-dir with the template AND had "fig:test" work successfully?
I’m setting up a browser repl through vim/fireplace/piggieback and I’m pretty confused about the moving pieces … if I start up an nrepl process with nrepl/start-server
and then start a figwheel build using figwheel.main.api/start
, is piggieback somehow getting wrapped into that down in figwheel someplace?