Fork me on GitHub
#clojurescript
<
2018-05-09
>
cjohansen04:05:28

I’ve been using cljs.spec.alpha a bit, and it seems that exceptions thrown from cljs.spec.test.alpha/instrument never include file, line number or column number. Does anyone know why, and/or how to fix?

cjohansen04:05:23

I use fdef and instrument, and when argument specs fail, I get exceptions with empty file name and line numbers, making it hard to locate the origin of the problem

Casey11:05:17

@dnolen bhb/expound works nicely, however I realize I have another issue... the Error objects being thrown by spec are wrapping the actual error message

cjohansen11:05:08

interestingly, this illustrates the <filename missing> that I was asking about just a few hours ago 🙂

Casey11:05:27

two birds 🐦

souenzzo11:05:37

There is some cljs api to compile a clojure string to a javascript string? (cljs/str-build {:src "(prn \"hello\")"}) ;; => {:output "console.log(\"hello\")"}

gdanov11:05:34

after long hiatus I'm doing some more serious clojurescript and have problems setting up the tests to produce reasonable feedback so some newbie questions ahead. * right now I'm "discovering" that (is ...) seems to swallow exception stack trace by design. Am I missing something? I have big problem figuring out which of the assertions in the production code failed * none of the testing tools seems to have the full picture when it comes to reporting, so I'm running doo and devcards in parallel to have reasonable insight what's failing

dnolen13:05:58

@ramblurr you can do a custom reporter for your tests

dnolen13:05:48

@gdanov you should always get the name of the test that failed

dnolen13:05:19

@christian767 there was some rudimentary work to do what Clojure does but this probably needs more work, look at the source of instrument if you want to help out here

Roger Roberts14:05:56

Does any one know how to perform a SOAP call from Clojure Script?

manutter5114:05:24

If I were running CLJS on a Node server, I’d probably use an npm package (https://www.npmjs.com/search?q=SOAP). That would mean learning how to integrate npm and CLJS, though, and I’ve managed to avoid that so far.

richiardiandrea16:05:06

@manutter51 :npm-deps should give you that, even if it's still in "testing" phase. In my case for instance I am using pg, node Postgres bindings from Cljs

lilactown16:05:50

I'm trying to use add-watch in an async test. it doesn't seem to be running correctly

lilactown16:05:49

(t/deftest test-with-watch
  (t/async done
    (let [state-atom (thing-that-returns-atom-and-eventually-changes)]
      (add-watch state-atom
                          :query
                          (fn [_key _atom old-state new-state]
                             (println old-state)
                             (println new-state)
                             (remove-watch state-atom :query)
                             (t/is false)
                             (done) )))))

lilactown16:05:50

nothing prints and the (t/is false) doesn't cause it to fail

lilactown16:05:33

ah, I figured it out. the thing-that-returns-atom-and-eventually-changes isn't returning the atom correctly. PEBKAC

lilactown16:05:42

second question: is there an easy/simple/tested pattern for creating cursors out of atoms?

lilactown16:05:22

e.g. I have (atom {:foo "bar"}) and I want to get an atom that will only watch the value of :foo for changes

lilactown16:05:15

I'm about to start making my own out of add-watch but I'm afraid of messing up cleanup of the watches

lilactown17:05:01

ok, went ahead and implemented a simple cursor. now I have a 3rd question! 😄

lilactown17:05:12

is there a way to set a timeout for an async test in cljs?

rnagpal18:05:27

Is there anything like this for reagent https://github.com/storybooks/storybook ?

cjohansen20:05:55

@dnolen ah, so the answer to “missing filename” is simply that it isn’t implemented yet? I’ll have a look and see if I understand what’s going on 🙂

dnolen20:05:02

@christian767 rather our reporting probably needs to be made more robust, not simply filename

symfrog21:05:08

I am trying to consume the @google/maps (https://www.npmjs.com/package/@google/maps) NPM module from cljs, but compilation is failing with Error: Can't resolve 'util' in 'node_modules/@google/maps/lib'. I have tried both cljs 1.10.238 as well as cljs built from master. Has anyone been able to consume the @google/maps module from cljs or have any pointers?

mfikes13:05:48

If possible, could you write a JIRA for this? See https://clojurescript.org/community/reporting-issues