Fork me on GitHub
#clojure
<
2020-05-23
>
Parenoid04:05:19

can someone tell me what command is being run to start cider in this video at this point? https://youtu.be/9sVGy0IovH8?t=1471

didibus04:05:39

You can press: C-h b and then type cider-jack-in-clj

didibus04:05:53

It'll show you what binding it is set too

Parenoid04:05:38

he has it bound to some binding and I don't know what command is being run.

craftybones04:05:33

For integration tests that needs external services to be turned on, for instance a DB, would you simply write a script that starts the service and then runs the test or is there another way to do it? Assume this is simply with deps and no Leiningen etc

seancorfield04:05:22

@srijayanth Depends on the DB. Which one are you using?

craftybones04:05:36

redis, but Mongo will soon follow

seancorfield04:05:25

Hmm, I'd probably use Docker locally to spin up test instances -- and do that as a separate step prior to running tests with <insert your favorite Clojure tool>

seancorfield04:05:09

We use Redis at work and used to use MongoDB. We use docker-compose up to stand up instances of Redis, Percona (MySQL), and ElasticSearch now. Used to also stand up MongoDB too.

didibus04:05:55

We just have a permanent development DB running, and use that for integ tests. Not very fancy and you pay when you don't use it. But it's the smallest instance and simple enough.

seancorfield04:05:55

If you were using PostgreSQL, I'd suggest looking at the embedded (Java) version -- which is what I use for testing next.jdbc

seancorfield04:05:33

@didibus A shared DB system? How do you manage individual standup and teardown of data around tests?

valerauko04:05:33

it's pretty easy with docker-compose

didibus05:05:20

Generally we'd create a new table from the test, and clean it up afterwards

seancorfield05:05:57

How does that work when you're testing code that has to assume certain tables and relationships?

craftybones05:05:09

@seancorfield - ok, that makes sense.

didibus05:05:20

Well, this is for a NoSql DB, so there is no relationship

didibus05:05:55

I wouldn't call it great. Just straightforward I guess. Create the tables you want, insert some documents, test, delete.

didibus05:05:45

There's definitely a lot of tests sharing the same tables as well, that just clean up the documents they created

didibus05:05:05

And there's definitely some test that don't even clean up properly and leave crap behind them if I'm being real honest 😝

didibus07:05:46

I can't remember, are you allowed to use the Clojure logo say in a blog post? Or as part of a tutorial guide?

valerauko10:05:18

is there some global flag to print exceptions thrown on other threads?

valerauko11:05:44

i tried Thread/setDefaultUncaughtExceptionHandler but it doesn't seem to work

valerauko11:05:07

i notice a large amount of throwables getting generated when profiling but i can't catch them anywhere

p-himik12:05:08

Is my understanding correct that (def a@ 1) is actually read as (def a (deref 1)) and hence invalid?

p-himik12:05:14

Ah, of course - macroexpand to the rescue.

vemv13:05:22

> '(def a@ 1)
(def a (clojure.core/deref 1))
fwiw I'd say @ is simply read, not macroexpanded

👍 4
borkdude21:05:06

Why no meta in string?

(binding [*print-meta* true] (print-str ^{:a 1} []))
"[]"

borkdude21:05:23

(btw in CLJS this seems to work)

jsn21:05:25

(binding [*print-meta* true] (prn-str ^{:a 1} []))

borkdude22:05:39

yeah and pr-str also works, but why doesn't print-str?

borkdude22:05:14

$ plk
ClojureScript 1.10.597
cljs.user=> (binding [*print-meta* true] (print-str ^{:a 1} []))
"^{:a 1} []"

jsn22:05:40

well, your guess is as good as mine (better even, I think), but mine is that *print-meta* docstring mentions reading things back by the reader, and reader-readable things is pr 's domain, not print 's, no?

borkdude22:05:17

yeah, that might be the correct explanation. maybe CLJS is not following Clojure here by accident