This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-04-04
Channels
- # beginners (31)
- # boot (24)
- # braid-chat (17)
- # cider (4)
- # cljs-dev (33)
- # cljsrn (5)
- # clojure (79)
- # clojure-austin (1)
- # clojure-poland (229)
- # clojure-russia (51)
- # clojure-uk (3)
- # clojurescript (68)
- # core-async (1)
- # core-matrix (1)
- # datomic (18)
- # editors (24)
- # emacs (7)
- # hoplon (118)
- # jobs (1)
- # jobs-discuss (1)
- # juxt (7)
- # off-topic (16)
- # om (121)
- # onyx (3)
- # parinfer (224)
- # protorepl (3)
- # re-frame (29)
- # reagent (1)
- # rethinkdb (2)
- # ring (1)
- # spacemacs (2)
- # untangled (182)
Hey, I can’t really figure this out. Is https://github.com/cemerick/clojurescript.test (which is deprecated) the one that is being referred to here https://github.com/clojure/clojurescript/wiki/Testing ?
@urbanslug: it is
@anmonteiro: So users should migrate their tests to doo?
sorry where is Doo mentioned in the links you pasted?
ah right
"I strongly suggest migrating to use the official core cljs.test + https://github.com/bensu/doo for test-runners and leiningen/boot integration. Thanks to all contributors for helping make testing ClojureScript workable until those tools arrived/matured!"
no you don't need to use Doo
no, it's not
what's deprecated is that clojurescript.test
library
cljs.test
is the official one and is not deprecated
apologies if I didn't understand
I'm not sure I follow, you can actually use both
cljs.test
for writing the tests, and lein-doo
for running them
but: you can run the tests without lein-doo
hope that clarifies things
doo for test-runners
I think that by test-runners it means circle, travis, etc
exactly
lein-do is a thing that helps you run your tests against a variety of js backends especially browsers
I mean, it’s not entirely because doo has to know how to run those tests; but it is in that you don’t strictly need it
Is there a good way to read a file with CLJS? At the moment I'm using a macro in a .clj
file called from my .cljs
, which just slurps the file, and that works great - if I pass the macro the string literal of the filepath. I'd like to put that string literal in a def variable, but that's giving me issues because of quoting and unquoting shenanigans in the macro. I'm pretty new to macros, so maybe this is just my own ignorance, but I can't find a way to format the body so (slurp (io/file map-file))
evaluates the (slurp (io/file ))
part as Clojure but pulls the map-file
variable from ClojureScript.
@numberq: you cannot pull runtime value of map-file
from clojurescript, macros are evaluated during cljs compile time, not during cljs run time
Yes it is. In cljs, it calls (load-map map-file)
, where load-map
is the macro located in clj, and map-file
is a def variable created in cljs
I mean, is *value* of map-file known at cljs compile time? it seems to me that you want to run slurp on a file, whose name is known at cljs run time
Yes the value is known at cljs compile time. That's exactly what I want to do. Is there no way to do that? Or is there some other way to read a local project file with cljs, without using macros?
are there any particular libraries people use to decode JWT tokens?
in cljs you would have to use some library function from underlying platform, in browser it is not possible for obvious reasons, under nodejs it would be readFileSync[1] for example, https://nodejs.org/api/fs.html#fs_fs_readfilesync_file_options
Also, the reason I don't want to hardcode it into the macro is because there will at some point be a lot of different maps being loaded, and it would be nice to just build that into a variable
so define those variables on clj side, and call a macro which does the job of calling various (load-map …) calls at compile time, there is no need to do this on cljs side (during runtime) if all is known at compile time
Is there a way to use cljs.test
in a continuous integration env (e.g circleci, travis-ci)?
The problem I encounter is that run-all-tests
always returns nil
So I have no way to detect if the tests have passed or failed
@viebel: in case of async tests you might need this -> https://github.com/clojure/clojurescript/wiki/Testing#detecting-test-completion--success
or you can also use lein-doo
which is a very good testing tool
how do I set the exit code of my script?
So that phantomjs
will exit with an error code?
@viebel: not sure about your setup, this is what I do with phantomjs in my runner script: https://github.com/binaryage/cljs-devtools/blob/master/test/resources/phantom.js#L27
https://github.com/binaryage/cljs-devtools/blob/master/test/src/tests/devtools/runner.cljs#L67
It worked
Given a large CLJS (om.next) app, how would I go about splitting out one component for stand-alone use, for example to be embedded in an iframe?
Does anyone here have a really good example of using d3 from ClojureScript? I'm having some trouble just googling for one
I have an example drawing a tree-map in reagent @danielpcox if that helps
Sure, I'd be interested. Thanks