This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-26
Channels
- # aleph (9)
- # announcements (10)
- # aws (1)
- # beginners (65)
- # calva (9)
- # cider (11)
- # clj-kondo (1)
- # cljdoc (61)
- # cljsrn (6)
- # clojars (2)
- # clojure (40)
- # clojure-austin (1)
- # clojure-belgium (1)
- # clojure-europe (4)
- # clojure-finland (1)
- # clojure-france (1)
- # clojure-italy (57)
- # clojure-nl (6)
- # clojure-spec (134)
- # clojure-uk (67)
- # clojuredesign-podcast (2)
- # clojurescript (40)
- # cursive (25)
- # datascript (1)
- # datomic (8)
- # events (1)
- # figwheel-main (18)
- # fulcro (36)
- # immutant (5)
- # jobs (5)
- # joker (3)
- # kaocha (41)
- # leiningen (4)
- # luminus (4)
- # off-topic (13)
- # onyx (8)
- # pedestal (2)
- # perun (7)
- # planck (2)
- # protorepl (9)
- # re-frame (3)
- # reagent (73)
- # reitit (5)
- # shadow-cljs (186)
- # sql (4)
- # vim (1)
- # yada (2)
@rickmoynihan I would expect --focus to work with both my-id
and :my-id
. If it doesn't that's a bug. Could you file a ticket?
@plexus sure… I’ll double check… I could’ve been wrong because the test output stating what suite was running scrolled beyond my buffer history limit and the suites were actually the same tests just run in different modes, so it was hard to see what happened.
My main issue at the time was the ambiguity in the docs
looks like you’re right :unit
and unit
both appear to work
we parse both to symbols: https://github.com/lambdaisland/kaocha/blob/master/src/kaocha/plugin/filter.clj#L88
I’ll take a look at the docs and see if I can submit a suggested improvement
@plexus: how about we change SYM
to ID
, and add a note to the docs that states ID
can be either a symbol or a keyword… and that if your test suite is a keyword you can identify it with either?
Though also wondering if the coercion here is potentially problematic.
i.e. you may have a specific test var called foo.bar/baz
and unwittingly use a test suite id of :foo.bar/baz
.
Not sure what would happen there, but I doubt it will happen much in practice.
actually scratch that changing SYM
to ID
is a bad idea
FOCUS
— doesn’t work either because there are also --skip
etc
we expect ids to be keywords, so maybe we need to more consistently use keywords also in examples
yeah — I think you’re right. might be best to tighten the descriptions, and perhaps eventually consider removing the coercion
though that may be a breaking change
though I don’t recall seeing any examples that targeted a test suite :id
. Which would also have made things clearer for me.
yeah that would be a breaking change so I would avoid that, I also think it's ok for the UI to be a bit forgiving here, but it's good to reinforce a consistent mental model
I think you're right that most docs use symbols on the command line, since that colon is pretty superfluous, but for consistency it might be better to add it.
I also wonder if we should add a preamble to essentially define ID
e.g.
> Tests to focus or skip are identified with an ID
which is either a keyword corresponding to the :tests
suite :id
or a symbol identifying a namespace or test var.
Then swap SYM
for ID
.
Also I wonder if the heading “On id” is wrong and should be “By var” or “By symbol”?
I guess this is where the confusion comes from, when talking about a namespace or var it's more natural to think of them as symbols, but internally they're always keywords
but on the API/UI level we coerce in some places because people want to test their my-ns/my-var-test
var, and since conveniently the test for that var has the same id as the var name (but turned into a keyword) that works.
No that snippet was my suggested quote… Though I am just about to submit a PR which changes that and a few other things, for your comments.
Also — whilst writing this I did just test the coercion behaviour you mentioned… It is a little strange being able to focus on a test namespace with :the.namespace.name
as a keyword.
you can view the whole doc here: https://github.com/lambdaisland/kaocha/blob/2cfdc883957f430abe7976f91c6d7cba3644c3cb/doc/06_focusing_and_skipping.md
well yeah, but that is the id of the test, e.g. if you do --print-test-plan
or --plugin kaocha.plugin.alpha/info --print-test-ids
you'll see those are all keywords. The question is: does the user need to know that, or can they pretend they're symbols? i.e. do we do more good than harm or vice versa by providing that convenience and basically telling people that for vars/ns's the ids are symbols, since that feels more natural and also works.
ahh good point. I think the doc changes work though; without people having to know that detail.
I guess I originally thought it would be better to let people pretend they're symbols, but I'm not so sure anymore, since var name == test id is really just a sort of convention, e.g. for ClojureScript tests that's already no longer true, since we prefix those to distinguish them from the same test vars in Clojure
@rickmoynihan I left a few comments, but I'm starting to think we need to be more up front here about what's actually happening. How about saying
I did consider that but figured it wasn’t necessary to be so specific… though that was before you told me about everything being a keyword in the test plan
> You can focus on a test suite >
--focus :test-suite-id
>Or on a test var
>--focus my.ns/my-test-var
>Or based on metadata
>--focus-meta :my-app/slow-test
ok will try and tweak it again