This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-02-09
Channels
- # announcements (1)
- # arachne (1)
- # beginners (34)
- # boot (5)
- # calva (68)
- # cider (34)
- # cljs-dev (1)
- # clojure (36)
- # clojure-italy (8)
- # clojure-spec (16)
- # clojure-uk (58)
- # clojurescript (29)
- # cursive (2)
- # datascript (9)
- # datomic (3)
- # emacs (10)
- # figwheel (1)
- # figwheel-main (11)
- # fulcro (33)
- # luminus (5)
- # mount (2)
- # nrepl (42)
- # off-topic (3)
- # other-languages (2)
- # parinfer (3)
- # perun (4)
- # prelude (3)
- # re-frame (6)
- # reagent (5)
- # shadow-cljs (23)
- # sql (37)
- # testing (1)
This is a cider-nrepl
question, let me know if this is not the right place to ask. Anyway: I am trying to fix a bug/shortcoming in Calva that when running tests for a namespace/file the tests for it’s test ns (same ns with -test
appended) are not run unless that namespace is loaded. For project tests there is a load?
key I can set to true on the message, but there is no such thing for namespace tests. I’ve tried to figure out from the Cider code how it is done there, but I do not quite follow what’s happening. Can I haz some pointers, pretty please? ❤️
Maybe orchard could be updated to minimize how much it loads based on the size of the query?
Thanks! I’ll load all namespaces for now. However, Cider has commands for running tests only for loaded namespaces in the project (that’s what happens if you don’t pass that load?
key to the test-all
op). That indicates that Cider does not load all namespaces for running the namespace tests, or I am getting that wrong, maybe?
Did you find https://github.com/clojure-emacs/orchard/blob/master/src/orchard/query.clj ?
No, didn’t find, thanks again! What I got from the cider-test code was that it only did that for running project tests, not when running tests for some given namespaces. But I could have gotten it wrong.
So, I am beginning to understand why you linked me to orchard/query… But I am not quite there yet, what is a var-query? What is an ns-query?
btw. Doing ns-load-all before running tests for a namespaces worked, but it is brutal and makes the first namespace test run take a long time in large projects.
Var-query is best documented on that orchard docstring, it's a data description for filtering vars/nss to be the target of an operation
Only test and apropos support it for now, but if you can think of somewhere to apply it, that would be cool
Looks like I will be able to use this to allow testing of the test under the cursor, right?
Maybe refresh would be a cool place to apply this. You could refresh just your test namespaces...
So, now I run the namespace tests using test-var-query instead, that’s cool. But I still fail at finding the -test
tests, because not loaded. Adding a truthful load-project-ns?
to the ns-query doesn’t seem to do anything. This is how my op looks like right now (TypeScript):
op: "test-var-query", ns, id, session: this.sessionId, "var-query": {
"ns-query": {
exactly: [ns],
"load-project-ns?": true
}
}
true
works elsewhere. But I did try with 1 as well since that is what replant does. 😃 Looking at the query code, am I correct in reading it as it only considers load-project-ns?
if project?
also is true? https://github.com/clojure-emacs/orchard/blob/master/src/orchard/query.clj#L23
I personally don't have a problem with that behaviour being changed. I don't think any users of cider would either. It wouldn't be an API change. If you wanted to be really crazy, you could grow the api to hold onto the old behaviour.
I didn't notice this behaviour particularly myself, but I always run with project set to true.
Regardless, it does seem wrong that they should be coupled like that (if that is what they are).
Yeah, I’ll peek into what happens to the values. But later, now family needs food. 😃 Thanks for the assistance so far!
https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/middleware/util/coerce.clj just fyo