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.
You may want <prefix>eb
to eval the code in your buffer (not on 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
?
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?
So the executing of the test like a function is more legacy support?
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
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)