Fork me on GitHub

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. Draft release notes:

👍 24

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.


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?


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.


i’m trying to get snapshot tests working


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?


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


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… 😬


code is here if you want to take a look: … 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


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...


no problem! i’ve since found a good string diffing library too, which improves things quite a bit:


for a re-frame app


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


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


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?