kaocha

Official support channel: https://clojureverse.org/c/projects/kaocha
zilti 2020-11-12T10:28:00.068900Z

Hmm. Any idea what I could poke to get more helpful info from my Kaocha setup? Or any idea on how to solve this?

practicalli-john 2020-11-12T13:00:48.069100Z

@defa -A still runs main-opts, although that will be removed in later versions. -M is the replacement for -A. -M will run the :main-opts from the last alias in a chain, so for -M:shared:shared_test:server:server_test then only the :main-opts in :server_test should run. However, the command line should over-ride the the aliases. I would try using

clojure -J-Dconfig.file=./conf/server.edn \
        -A:shared:shared_test:server:server_test \
        -M -m kaocha.runner "$@"
Also check you have the latest Clojure CLI version 1.10.1.727 If that doesn't work, probably worth asking in #tools-deps

Charlie Briggs 2020-11-12T14:56:48.070800Z

is there a way to only fail fast for each deftest context? i.e. adapting this example https://cljdoc.org/d/lambdaisland/kaocha/0.0-359/doc/-fail-fast-option

Given a file named "test/my/project/fail_fast_test.clj" with:

(ns my.project.fail-fast-test
  (:require [clojure.test :refer :all]))

(deftest test-1
  (is true))

(deftest test-2
  (is true)
  (is false)
  (is true))

(deftest test-3
  (is true))

    When I run bin/kaocha --fail-fast

    Then the exit-code should be 1

    And the output should contain:

[(..F.)]

FAIL in my.project.fail-fast-test/test-2 (fail_fast_test.clj:9)
expected: false
  actual: false
3 tests, 4 assertions, 1 failures.

Charlie Briggs 2020-11-12T14:57:48.071Z

context is that for integration tests I don’t want to continue if a pre-condition has failed as the output becomes hard to follow

Charlie Briggs 2020-11-12T14:59:06.071200Z

I guess the equivalent from another language would be testify/assert vs testify/require in the Go library https://github.com/stretchr/testify

plexus 2020-11-12T15:00:18.071500Z

easiest would be to just throw an exception

plexus 2020-11-12T15:00:41.071700Z

that's what fail-fast does too under the hood, it's only way to "break out" of a running deftest

Charlie Briggs 2020-11-12T15:01:11.071900Z

ah, so I could in theory wrap is with something else, such as is-required and just throw out of it? That could work

plexus 2020-11-12T15:02:40.072300Z

something like that, or have your own variant of is which throws on failure. is by default catches all exceptions inside the is

Charlie Briggs 2020-11-12T15:06:57.072500Z

yup, just checked out the implementation which hadn’t inspected before. Thanks for your help!

Charlie Briggs 2020-11-12T15:12:00.072700Z

worked a charm :star-struck:

zilti 2020-11-12T20:44:03.073200Z

I suspect that the reason could be that it is ran by GitLab Runner?

2020-11-12T22:35:19.076300Z

Hi all, I am trying to figure out how to specify a namespace exclusion with kaocha. Here's what is in my deps.edn:

:coverage    {:extra-deps {lambdaisland/kaocha-cloverage {:mvn/version "RELEASE"}}
                              :main-opts  ["-m" "kaocha.runner"
                                           "--plugin" "cloverage"
                                           "--ns-exclude-regex" "app.main"]}
The --ns-exclude regex should be a vector of regexes. I am not quite sure how to do this with deps. Do I do a literal list in the string?

plexus 2020-11-13T08:32:33.076900Z

start with bin/kaocha --help, you will see that there is no --ns-exclude-regex option, but there is a --cov-ns-exclude-regex

plexus 2020-11-13T08:33:06.077200Z

just pass it a string as you do now, if you want to pass more than one then specify the option more than once

2020-11-13T14:20:58.077400Z

thanks!

lread 2020-11-12T23:14:54.076400Z

Hiya @plexus! Just did a small README PR on deep-diff2 and got the same error. Do you want your kaocha circleci configs updated to above via PR? Lemme know.