Fork me on GitHub
#kaocha
<
2020-04-23
>
plexus07:04:10

that's one option... could you share what the above looks like with the :debug reporter?

plexus07:04:45

or in particular with this version of it, it currently doesn't print ::printed-expression, and I'd like to know if it gets that or not

(defn debug [m]
  (t/with-test-out
    (prn (cond-> (select-keys m [:type
                                 :file
                                 :line
                                 :var
                                 :ns
                                 :expected
                                 :actual
                                 :message
                                 :kaocha/testable
                                 :debug
                                 ::printed-expression])
           (:kaocha/testable m)
           (update :kaocha/testable select-keys [:kaocha.testable/id :kaocha.testable/type])))))

rgm03:04:44

So I used this debug reporter (not the one on master) and got this with a focus-meta on the particular test … running both the clj and cljs units (cljs in node):

rgm04:04:59

Realistically, just pre-preparing the failure string with the 2-arity of clojure.test/is also works, since that does do my defined string conversion while it’s still a deftype and not some transit-ish thing.

rgm04:04:20

not as pretty in cljs, though. Let me know if there are any other experiments you want me to try.

plexus10:04:06

hmmm it's surprising to me that those :fail messages don't have a :kaocha.report/printed-expression key. This would normally contain the complete message to be output, but generated on the cljs side. I'll have to look into that. In general providing and api for and documenting how people can add their own print handlers for clj/cljs would be very handy, I confuse myself right now when looking into that.

plexus07:04:43

if you are able to use latest master that would also work

danielcompton18:04:35

When I run the tests I get this error:

danielcompton18:04:45

$ bin/run_feature version_filter
cat: features/version_filter/args: No such file or directory
[E]
Randomized with --seed 1996770488

ERROR in unit (ns.clj:13)
Exception: .FileNotFoundException: Could not locate kaocha/api_test__init.class, kaocha/api_test.clj or kaocha/api_test.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.
 at clojure.lang.RT.load (RT.java:462)
    ...
    kaocha.ns$required_ns.invokeStatic (ns.clj:13)
    kaocha.ns$required_ns.invoke (ns.clj:11)
    kaocha.type.ns$eval3366$fn__3367.invoke (ns.clj:29)
    ...
    kaocha.testable$load.invokeStatic (testable.clj:77)
    kaocha.testable$load.invoke (testable.clj:64)
    ...
    kaocha.testable$load_testables.invokeStatic (testable.clj:142)
    kaocha.testable$load_testables.invoke (testable.clj:134)
    kaocha.load$load_test_namespaces.invokeStatic (load.clj:49)
    kaocha.load$load_test_namespaces.doInvoke (load.clj:37)
    ...
    kaocha.type.clojure.test$eval4784$fn__4785.invoke (test.clj:16)
    ...
    kaocha.testable$load.invokeStatic (testable.clj:77)
    kaocha.testable$load.invoke (testable.clj:64)
    ...
    kaocha.testable$load_testables.invokeStatic (testable.clj:142)
    kaocha.testable$load_testables.invoke (testable.clj:134)
    kaocha.api$test_plan.invokeStatic (api.clj:41)
    kaocha.api$test_plan.invoke (api.clj:34)
    kaocha.api$run$fn__3073.invoke (api.clj:85)
    ...
    kaocha.api$run.invokeStatic (api.clj:83)
    kaocha.api$run.invoke (api.clj:71)
    kaocha.runner$run.invokeStatic (runner.clj:129)
    kaocha.runner$run.invoke (runner.clj:71)
    kaocha.runner$_main_STAR_.invokeStatic (runner.clj:162)
    kaocha.runner$_main_STAR_.doInvoke (runner.clj:141)
    ...
    kaocha.runner$_main.invokeStatic (runner.clj:173)
    kaocha.runner$_main.doInvoke (runner.clj:171)
    ...
1 tests, 1 assertions, 1 errors, 0 failures.

plexus09:04:58

sorry Daniel, that script is vestigial. We used to have a different kind of feature tests before we used cucumber, that's what this script was for. Now you just use kaocha, e.g. bin/kaocha --focus :plugins.version-filter