Fork me on GitHub

I had a couple of questions around self-hosted CLJS if someone has some experience with it? 1. I'm under the impression you can override the line number / file path of the evaluation like you can with a line numbering pushback reader for eval in Clojure? 2. Could I make the self hosted ClojureScript inherit from the parent environment to pick up all dependencies in the outer context? Or is it supposed to be an isolated environment. I mainly just want to be able to set the line number and file path of an evaluation from within a ClojureScript REPL. I think I can only do that through some self hosting trickery, maybe I'm wrong there though :thinking_face: if anyone knows of some fun hacks I can do to change the line number within a CLJS REPL then I'm all ears!


its not possible from within a CLJS REPL without first patching CLJS and adding the funtionality (like it was added to Clojure not long ago)


Oh, I vaguely recall seeing those as bindings somewhere in Clojure. I wonder if it'd be worth submitting a patch for that for parity at some point... hmm.


I'm worried that if I go down the self hosting route I'll just encounter different issues around dependency loading further down the line.


hello dear clojurescripters, is anybody around who can point me to how dynamically create tests in clojurescript? I’ve been fumbling with this for a while and I’m wondering if I’m looking at the problem the wrong way. The idea is that I have already a set of nicely formatted specifications, and I’d like, for each of them, to do the equivalent of (deftest test-name test-body).


are you familiar with cljs.test/are?


hi! yes, but this case is a bit more involved: I need to test the result of async functions, and only one of those can live in each test (according to the documentation)


alas: > You cannot have more than one async test per deftest form or only the first one will run.


I see! No idea from my side. Given (deftest test-name test-body) seems a pretty trivial macroexpansion, you could write that code yourself. Or if you have far too many specifications, you can create a one-off program that will (println (pr-str (list 'deftest (gensym) the-specification))) ...and you copy/paste the result into a file


actually the latter may be a good idea 🙂


Hi. I have something like that (I think) in my toy project. Here is the data with name of the test, query to be executed and expected results: Here all tests run: I am running more cases in single test. After each case I run done-single function that when called last time, calls done ( Mocha (js test framework I've tried to imitate in this case) works in similar way:


(also, the fact that I’m not finding literature on the subject makes me think that it’s either obvious or obviously a bad idea)


Macros could do that, although not dynamically (they run at "compile" time)


yup, that is what I’m counting on (I should have said programmatically rather than dynamically). Anyway, I think I’m getting somewhere 🙂


I'm working on a cljs app that has a dependency that is my own local utils lib in a .cljc file. I want to be able to make changes in the utils lib while working on my cljs app. So instead of adding it as a dependency in deps.edn, I symlinked it into the src directory. It works in the sense that I can use the lib, but if I change something in the utils.cljc file I can't see the changes in my cljs app's namespace. And I can't seem to just evaluate (with CIDER) the utils.cljc file/namespace at all. Anybody know what's wrong, and how I can make it work?


Apparently symlinks don't work with CIDER, hm...


in CIDER you can use sesman-link-with-X where X is buffer, directory, project. Should let you link the two


oh, interesting


if you’re using deps.edn, you could just use a local root


@lilactown But that doesn't make it reload when I change it, right?


I used that before, but the symlink was my attempt to make the utils lib act as part of the app so that it would reload just like the app code.


I’m not sure. When I used shadow-cljs + deps.edn + local roots, my code does reload


It might have to do with other issues reloading cljc or macros


@lilactown Or maybe it's shadow-cljs? I haven't used it


yeah, not super familiar with like deps.edn + figwheel or other setups