kaocha

plexus 2022-09-07T07:25:41.779419Z

@dharrigan we have no plans or intention to further support midje, the recommended migration path is via fudje. Midje is a very weird animal and there's just no way to do it well.

dharrigan 2022-09-07T07:26:45.425389Z

Yeah, it's not well liked at our place, so we are going to start moving across to expectations...

plexus 2022-09-07T07:27:54.376999Z

I'm sorry we can't provide a better experience for midje, but it also seems there are better places to put our energy, given that folks are generally moving away from it.

plexus 2022-09-07T07:28:32.297899Z

Have you tried fudje? It should be a drop-in replacement that's clojure.test compatible, I'd be curious to hear if that's not your experience.

dharrigan 2022-09-07T07:28:34.544639Z

Yeah, totally understand.

dharrigan 2022-09-07T07:28:50.467379Z

Yeah, couldn't get fudje to work either

dharrigan 2022-09-07T07:29:22.186509Z

I'll have another look to see why

plexus 2022-09-07T07:29:45.778459Z

in general, or with kaocha? we do care about working with fudje, but there should not be much (if anything) for us to do, since they are based on clojure.test

dharrigan 2022-09-07T07:29:57.635729Z

Let me get back to you

dharrigan 2022-09-07T07:30:02.213639Z

I'll have to reattempt it again

plexus 2022-09-07T07:30:03.515739Z

ok 🙂

plexus 2022-09-07T07:32:36.378159Z

For the figwheel folks, it would be helpful to share your config, especially cljs compiler config. Contrary to shadow figwheel uses the vanilla compiler, and so figwheel projects should be able to use kaocha-cljs, but there might be compiler flags that interfere with how kaocha-cljs works. kaocha-cljs2 should be usable in any scenario, it's completely agnostic to how you compile or which runtime env you use, but (I'm aware) it's a PITA to set up. We do plan to do something about that.

plexus 2022-09-07T07:34:17.769059Z

The other issue with kaocha-cljs is that it's a pain to debug, because we rely on the cljs prepl which gives very little indication of what the problem is when things go wrong, but for simple setups it's still pretty useful, because it's so much simpler internally compared to kaocha-cljs2.

plexus 2022-09-07T07:35:26.010879Z

Please also note that the right place to report things is in the github issues.

🎫 1
MIJOTHY 2022-09-07T16:14:07.205149Z

when I use lein test on some defspec like

(ns seed-repro-test
  (:require
   [clojure.test.check.clojure-test :refer [defspec]]
   [clojure.test.check.generators :as gen]
   [clojure.test.check.properties :as prop]))

(defspec zero-identity
  100
  (prop/for-all [i gen/small-integer]
                (= 0 (* i 0))))
the generative seed and other info is exposed, like so:
[0] % lein test                   

lein test seed-repro-test
{:result true, :num-tests 100, :seed 1662567118509, :time-elapsed-ms 6, :test-var "zero-identity"}

Ran 1 tests containing 1 assertions.
0 failures, 0 errors.
when running kaocha, i don’t see this info exposed:
[0] % lein kaocha  
--- unit (clojure.test) ---------------------------
seed-repro-test
  zero-identity

1 tests, 1 assertions, 0 failures.
is this something I can enable via configuration?

MIJOTHY 2022-09-07T16:14:46.809999Z

project.clj:

(defproject seed-repro "0.0.0"
  :dependencies
  [[org.clojure/clojure "1.11.1"]
   [org.clojure/spec.alpha "0.2.194"]
   [org.clojure/test.check "1.1.1"]
   [lambdaisland/kaocha "1.68.1059"] ]
  :aliases {"kaocha"
            ["run" "-m" "kaocha.runner"]})
tests.edn:
#kaocha/v1 {:reporter kaocha.report/documentation}

plexus 2022-09-07T17:15:19.109429Z

Hmm this vaguely rings a bell. Can you try with --reporter debug?

MIJOTHY 2022-09-07T17:23:42.891369Z

ah, i see a relevant message:

{:type :pass, :file "assertions.cljc", :line 34, :message {:pass? true, :num-tests 100, :time-elapsed-ms 7, :seed 1662571265810, :test-var "zero-identity"}, :kaocha/testable #:kaocha.testable{:id :seed-repro-test/zero-identity, :type :kaocha.type/var}}
{:type :end-test-var, :file "form-init1272814458836001206.clj", :line 1, :var #'seed-repro-test/zero-identity, :kaocha/testable #:kaocha.testable{:id :seed-repro-test/zero-identity, :type :kaocha.type/var}}

MIJOTHY 2022-09-07T17:28:34.749259Z

hm, so on failure I get the seed. ill dig in a bit more as to why my actual test suite isn’t showing it tomorrow

MIJOTHY 2022-09-07T17:32:15.140249Z

ah, the issue is when an exception is thrown (e.g. during such-that generation). but the vanilla test runner doesn’t show the seed there either. and i only really care about the seed on failures atm. so nothing to worry about. thanks for the help

ERROR in seed-repro-test/zero-identity (generators.cljc:435)
Uncaught exception, not in assertion.
Exception: clojure.lang.ExceptionInfo: Couldn't satisfy such-that predicate after 10 tries.
{:pred #object[seed_repro_test$zero_identity$fn__6210 0x1a06602f "seed_repro_test$zero_identity$fn__6210@1a06602f"], :gen #clojure.test.check.generators.Generator{:gen #object[clojure.test.check.generators$sized$fn__3061 0x5b6cc344 "clojure.test.check.generators$sized$fn__3061@5b6cc344"]}, :max-tries 10}