This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-09-02
Channels
- # admin-announcements (21)
- # announcements (1)
- # boot (128)
- # cider (18)
- # cljs-dev (10)
- # clojure (112)
- # clojure-brasil (2)
- # clojure-italy (4)
- # clojure-japan (12)
- # clojure-russia (38)
- # clojurescript (241)
- # clojutre (1)
- # datascript (2)
- # datomic (3)
- # events (1)
- # hoplon (38)
- # jobs (1)
- # ldnclj (5)
- # melbourne (8)
- # off-topic (2)
- # om (9)
- # re-frame (13)
- # reagent (43)
- # sneer-br (24)
- # sydney (3)
guys how do you handle environement configuration, I mean something like the url of your server
@benzen: i think this is the latest hotness for that: http://www.martinklepsch.org/posts/parameterizing-clojurescript-builds.html
thanks @jackjames
I’ve been trying to get the async test example given in the cljs.test.async
macro source to run but it fails every single time. It’s essentially a copy paste, with an (is true)
assertion. Has anyone been able to get this working successfully?
This is it, basically:
(deftest example-with-timeout
(async done
(js/setTimeout (fn []
(is true)
(done))
0)))
@dnolen Here are some more details.
Running ClojureScript 1.7.28.
Using cljs.test.
Running tests via lein cljsbuild auto test
.
None of the tests after the above run at all. The whole suite is terminated, with no summary.
The rest of the suite works just fine if I remove the async test, and keeps running even after failures occur.
in general when saying something “doesn’t work” it’s important to add at least a few words about your environment
I’m sorry if I was unclear. We ported our entire test suite to cljs.test
from cemerick.cljs.test
. The tests run, and they have been for a while. Every last one. With cljsbuild
. Could you please clarify what you mean by “support" here? Do you mean “support certain specific features”, or "support at all”?
The project I’m experiencing this issue with is proprietary, so I can’t share anything too detailed. However, the structure isn’t all that different from this other project https://github.com/onaio/milia, which is Open Source. Which uses cljs.test
. Which also uses lein-cljsbuild
.
@okal: cljsbuild doesn’t have any real support for cljs.test
or even clojurescript.test
, all it does is build
once built I just run with :notify-command
, I’ve never used clojurescript.test
so I can’t help you there.
lein cljsbuild auto test
picks up any changes to your suite, or to the code under test, and runs them automatically. It works with both. It could be a peculiarity of the async macro that prevents tests using it from working with lein-cljsbuild
(Not that I can see from the source).</digression>
Anyway, my point is, tests written using either library work. Just tests using the async
macro that fail. Thanks for taking time to answer, all the same, @dnolen.
so there’s something about your setup which might have nothing to do with cljs.test
or async
@okal I see that you’re using phantom. One thing to try to isolate this, would be to just build your test file and try to run the tests directly with phantom.
@okal or slimer.js (where source maps are supported) - while I’m skeptical at the moment - it’s totally possible there’s some subtle bug with async
that I haven’t heard about before.
That’s helpful, thanks. I’d actually thought of switching to Slimer in a moment of frustration.
@okal I saw the behavior you describe with that exact example when trying to to use the async macro in planck a few days ago. I haven’t had a chance to go back and investigate further. I believe if I took out the (is true)
from that example it didn’t terminate. This is not in browser however.
@ericstewart: I would not confuse any issues with anything involved anything bootstrapped
the tests would just terminate with it in. Not sure how that helps as Planck (https://github.com/mfikes/planck) is a bit of of a different beast. Using ClojureScript 1.7.122 at the moment
not surprising
@ericstewart: like I said assuming bootstrapped things are related to non-bootstrapped things is not a reasonable thing to do.
@ericstewart Odd. Like @dnolen said, probably unrelated, but might still be helpful. Not ruling anything out (including weird setup on my end, which is the likely culprit) at this point. Thank you.
@okal OK I took a moment to test phantom.js with nothing other than the cljs.jar
. One file with one test using async
and a setTimeout
and one assertion.
this would rule out that anything obvious in ClojureScript itself is the source of the issue
Did a minimal repro with just the one test, running with cljsbuild. Behaves the same way, so I think you’re right.
@dnolen that's incredible.
I’ve got an application built with re-frame. I’ve been integrating pushy and bidi on the front end, so I can also handle state switches based on the path. But then it becomes a bit of a synchronization issue... Say I hve something with possible ui-states :state-1 and :state-2. Going to /the-site/state-1 will fire up that state. So far so good. Then we go to /the-site/state-2 and click on something, which fills in data for state-1. Right now I'm just changing the value on the app-state, but now I need to change both the value and the route, to keep them in sync (otherwise /the-site/state-2 would remain). Seems like the best thing to do is to pick one thing that'll drive everything... likely the routes, since that's user-controllable as well, and firing up the app-state changes from there.
@dnolen I was mixing them up earlier, under the (incorrect?) impression earlier that calling (done)
would relinquish control from the async block, but I’ve managed to reproduce it, with just a single async test in a single file.
@wilkerlucio Musicoacher looks really cool Nice work.
@okal: yeah was just thinking through the possibilities. mixing async/sync tests definitely works and is supported.
Has anybody seen messages like these:
WARNING: No such namespace: clojure.lang.PersistentHashMap, could not locate clojure/lang/PersistentHashMap.cljs, clojure/lang/PersistentHashMap.cljc, or Closure namespace "" at line 146
WARNING: Use of undeclared Var clojure.lang.PersistentHashMap/create at line 146
Successfully compiled "resources/public/static/js/app.js" in 1.841 seconds.
I get these and can't hunt them down. The lines point to some defc or defcs forms (macros from Rum), nothing special about them. And the errors only happen when using figwheel, I don't get them when compiling the whole application with cljsbuild.The strange thing is that it doesn't happen on every use of a defc macro, only sometimes.
@dnolen Thank you. Give this a try when you have a chance https://github.com/okal/async-cljsbuild-failure-repro
@jrychter: assuming that you have done a lein clean
to see if the warning goes away? And things are still compiling and working though correct?
@okal in general prefer to have something more minimal, before I look at that you should try some more things.
@bhauman: lein clean, yes. I haven't tried clean-builds. Things start behaving strangely after the errors: app in Safari starts working very slowly after reload. I would like to narrow it down, but I need a pointer.
@okal so note I never look anything involving cljsbuild, I don’t have the time or patience for 3rd party issues.
I thought we’d established that cljsbuild is part of the problem after your earlier attempt at reproduction. I misunderstood.
@jrychter: I'm assuming you have lein 2.5.2 and you are using fighweel in a script that was setup by chestnut?
@bhauman: lein 2.5.2, figwheel 0.3.8 (same behavior with 0.3.7) and my setup is derived from chestnut. Slightly simplified, as I removed piggieback and weasel. ClojureScript 1.7.48.
@bhauman: oh, one more variable: I run everything via cider-jack-in. Then from the REPL I launch figwheel as in the chestnut template (the start-figwheel
function). But I also just tried from lein repl
, same symptoms.
Well I guess I have to try to recreate this using a minimal example — I have no hints to go on.
@jrychter: two things to try come to mind. Downgrade lien to 2.5.1 ... I'd really be interested to see if the problem goes away in this case. Otherwise I would try a standard lein figwheel
setup where you launch figwheel separately from nrepl and your server code.
@okal thanks
hello. i'm having a go at cljs+nodejs. is there anything more clojurescripty than using expressjs? something that looks like compojure, perhaps?
If you’re looking just for client-side routing, look into https://github.com/gf3/secretary or, if you’re looking for bidirectional matching, https://github.com/juxt/bidi.
@akiva: thanks. i'm looking for routing on the server-side, ala expressjs or compojure. can secretary be used like that?
i could write the api in clojure, but im hoping a cljs version will use up less memory when running!
@dnolen: very possible i was doing something dumb, but a cursory glance at the used heap size whilst running a simple compojure app was ~250MB. JVM claimed the rest of the space available in case it needed to grow
cjwebb: how did you run it?
@cjwebb: there’s going to memory defaults for your platform, if you want something different you need to supply this
@dnolen: true. I didn't really investigate tuning them at all. i'll have go limiting it to 64mb
also Node.js is optimized for starting small but poorly reflects stable usage, it will also grow over time
people are reporting anywhere from 400mb - 500mb RAM usage in this case for an express.js app
assuming V8 is somehow magically going to have smaller memory than JVM for a real application - that’s a pipe dream
looks like the clj app does perform when i restrict the heap-size to 64MB, so i'll go with that for now. sorry for wasting everyone's time 😐
@cjwebb: no worries there’s an incredible amount of JVM FUD out there these days so hard to find the facts admittedly
Opportunity grants available for Clojure/conj http://clojure-conj.org/opportunity
I've run small Clojure webapps with 64MB of heap just fine. These days I usually use 256MB in most cases, just to leave some headroom, and because servers are cheaper than they used to be.
When compiling in advanced mode, what’s the right way to prevent js-interop attributes from being renamed? I used “aget”, but that doesn’t appear to work. I remember reading about a goog function, but haven’t been able to find it.
(set! (.-MyProp js/window) true)
(set! (aget js/window “MyProp”) true)
That’s just an example. But no luck with both of those patterns for me, in advanced compilation.
@wildermuthn: 1) don’t use aget, use goog.object/get 2) I’m skeptical that the second thing doesn’t work
@wildermuthn: use goog.object/get
ok thanks.
Maybe there’s another problem I’m overlooking, but good to know what to use now.
Would there be a reason not to use goog.object/set
instead of set!
?
want to improve this: https://github.com/darwin/plastic/blob/master/cljs/src/worker/plastic/worker/editor/layout/spatial.cljs#L18-L20
@wildermuthn: ah your second example just isn’t really valid code
@wildermuthn: use goog.object/set
Ok, thanks!
@dnolen: rewrite would not be as performant I guess, sorted-map does not support transient: No protocol method IEditableCollection.-as-transient defined for type cljs.core/PersistentTreeMap
and I keep getting Refused to execute script from '
I’m launching it on the client as
(figwheel/start
{:websocket-url ""
:on-jsload main/refresh!})
basic Om project if anyone is interested in how Om works https://github.com/jtackett/om-tictactoe
the only nicety I’ve seen from this design is that you just have one bg console rebuilding things
I’m getting these guys: Exception in thread "main" java.lang.ClassNotFoundException: namespace.of.my.closure.defined.symbol, compiling: ...
What does your actual namespace look like?
make sure the namespace correlates to the directory structure and the path has no dashes
ok, so the dashes are out 😄
also closure
? was that s
intended?
any stacktrace?
are we talking about :closure-defines
?
tried plain strings?
Hm. It should never try to load that. You’re not quoting the symbol in project.clj
yes?
@tel: darn well the stack overflows are probably from the interaction of figwheel and the clojure.browser.repl that is being used by weasel.
Not using figwheel or lein so probably not going to be able to help
@martinklepsch: that’s cool, thanks for looking in
@tel: I tried to patch it so they can work together but it sounds like its not working
my god this has never stopped being a pain in the but. symbols having to cross a serialization border in lein
:closure-defines
only works with :advanced
use goog-define
in the source to set defaults for dev
@juhoteperi: it doesn't say it only works in advanced mode in the link you sent
"Ignored under :none and :whitespace modes."
@juhoteperi: @tel, right, they’re only ignored if you do not use goog.define
Hmh, looks like Cljs compiler might write closure-defines to the shim ns in :none
mode.