Fork me on GitHub
#clojurescript
<
2018-09-24
>
mfikes11:09:25

The ClojureScript compiler is nearing release! I suggest building master and using it with your project for a few days to see if you spot any compiler bugs. https://clojurescript.org/community/building Draft release notes: https://github.com/clojure/clojurescript-site/blob/cbe70516580fb71531a2d9169d34129c3a754ab2/content/news/2018-09-01-release.adoc

👍 24
jhughes15:09:36

Hi everyone, so i'm using the Cljsjs.three package to create some 3d viz. It appears as if the THREE.SceneUtils is deprecated and used to be apart of the three.js library but is now external and throwing this error. How do i include it in cljsjs file now? *Note: I do not have a html file within my project.

rsslldnphy20:09:09

might be a daft question because i’m not js savvy, but is there an easy way to create and write to files when running cljs.test tests?

rsslldnphy20:09:47

do i have to run the tests using node to be able to do that?

Braden Shepherdson20:09:51

that's quite environment-sensitive in JS. Node can do it, the browser engines not so much.

rsslldnphy20:09:16

i’m trying to get snapshot tests working

soulflyer10:09:23

Sorry, nothing useful to add.. Very interested in how you get on with this though. Are you using some available tools or building from scratch?

rsslldnphy18:09:39

there seem to be a few simple clojure implementations of the idea of snapshot testing but they appear to focus more on just normal functions. for me its utility lies in view testing, and i haven’t seen any working examples of that with clojurescript

rsslldnphy18:09:20

i’ve gotten something sort of working using enzyme to render the view and then handling the writing and comparing of snapshots myself. however as my tests run in a headless chrome browser, writing files is difficult. i get around it in a sort of hacky way by having figwheel run a ring handler with endpoints for writing snapshot files to my local machine… 😬

rsslldnphy18:09:15

code is here if you want to take a look: https://github.com/caseworker/caseworker/pull/40 … still some stuff that needs doing to make it properly useful, including finding a better string diffing function so the test output is actually readable

soulflyer12:10:46

Thanks for that. It sounds complicated at first, but looking at the code it doesn't seem too tricky. Getting figwheel to run a simple server is a nice trick...

rsslldnphy16:10:15

no problem! i’ve since found a good string diffing library too, which improves things quite a bit: https://github.com/caseworker/caseworker/commit/d40e57d66fe3fef957ae357e632800142e77f391

rsslldnphy20:09:20

for a re-frame app

rsslldnphy20:09:43

so the first time i run the tests, i render the view, and if there’s no snapshot, i write one to file

rsslldnphy20:09:58

on subsequent test runs, i compare the rendered view with the previously rendered snapshot

rsslldnphy20:09:06

at the moment i’m using a cljs-repl with piggieback and nrepl - i’m guessing that’s not a node repl though? any way to configure it so it does use node?