This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-31
Channels
- # announcements (3)
- # babashka (75)
- # beginners (16)
- # calva (124)
- # cider (10)
- # clara (2)
- # clj-kondo (1)
- # cljdoc (4)
- # cljs-dev (14)
- # clojure (104)
- # clojure-australia (4)
- # clojure-czech (5)
- # clojure-europe (14)
- # clojure-germany (48)
- # clojure-nl (4)
- # clojure-serbia (4)
- # clojure-uk (34)
- # clojurescript (60)
- # community-development (16)
- # conjure (12)
- # core-async (34)
- # cursive (42)
- # data-science (7)
- # deps-new (9)
- # depstar (1)
- # emacs (11)
- # events (2)
- # fulcro (15)
- # graalvm (1)
- # inf-clojure (1)
- # jobs (3)
- # jobs-discuss (1)
- # joker (7)
- # juxt (8)
- # lsp (20)
- # malli (42)
- # meander (4)
- # off-topic (5)
- # pathom (2)
- # polylith (13)
- # re-frame (39)
- # reagent (9)
- # reitit (31)
- # releases (2)
- # rewrite-clj (23)
- # shadow-cljs (39)
- # spacemacs (11)
- # specter (6)
- # tools-deps (8)
- # xtdb (12)
I'm not quite sure if I'm doing something wrong here but after evaluating forms inside my namespace, after I change then and run <leader>ef to evaluate the whole file, I'm getting some stale outputs, which seem to be using some of the old code. e.g.
>> (out) Old println
>> (out) New println
When the code only has the new oneSo <prefix>ef
will eval the file from disk, not what's visible in your buffer. If you haven't saved yet you'll have some in memory state from your form evals but the ef will eval the old version from disk.
@olical I use https://github.com/fulcrologic/fulcro-spec for testing, and it has a deftest wrapper that takes a string instead of a var symbol
ie: (specification "thing under test" ,,,)
and extracting the test var breaks when there is no symbol but a string
I’ve written a command that essentially evals the root form surrounded with parenthesis, ie ((specification "blah" ,,,))
(note in my case i’m calling kaocha.repl/run
as workaround for https://github.com/Olical/conjure/issues/188)
I was then wondering why it’s currently implemented by sending the var to clojure.test/test-vars
?
additional question: it initially surprised me that running the current test did not evaluate the test contents, so I would be running the older test instead of what was in the buffer/file.
changing it to what i’m doing above, ((deftest f,,,))
would evaluate the test so i’m always running what’s in my buffer, instead of having to evaluate the test to refresh it and then run it
(but that might not be the preferred behavior? not sure, which is why i’m asking)
Not sure I really understand the question, it seems like you need a way to run a fulcro spec test under the cursor? Which is a different use case to t/deftest
imo? I could probably add support for it though?
And I pass it to test-vars because that's a nice way to run Clojure tests, I think that's pretty normal? Maybe not for fulcro's tests, but I'm afraid I've never used those. Again, support can probably be added somehow.
wrt the second question, I decided not to do two things when you requested one because I'd rather a boring surprise to an exciting one. If you have a change in your code and you definitely don't want that evaluated yet (you wanna test the old version in memory) then you'd have no way to do that. I'd be complecting eval and test, I'd rather those were separate while allowing users to create their own combined mappings if they so wish.
And I honestly didn't think of just executing the test, from my understanding the "right" way to do it is test-vars, otherwise you don't get the setup/teardown I think?
I guess your reasoning makes sense, so it’ll be my own mapping… extracting the test var from the string would involve calling a fulcro-spec function… not sure if that’s worth generalizing when it’s a one off