Hmm. Any idea what I could poke to get more helpful info from my Kaocha setup? Or any idea on how to solve this?
@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-depsis 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.
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
I guess the equivalent from another language would be testify/assert
vs testify/require
in the Go library https://github.com/stretchr/testify
easiest would be to just throw an exception
that's what fail-fast does too under the hood, it's only way to "break out" of a running deftest
ah, so I could in theory wrap is
with something else, such as is-required
and just throw out of it? That could work
something like that, or have your own variant of is
which throws on failure. is
by default catches all exceptions inside the is
yup, just checked out the implementation which hadn’t inspected before. Thanks for your help!
worked a charm :star-struck:
I suspect that the reason could be that it is ran by GitLab Runner?
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?start with bin/kaocha --help
, you will see that there is no --ns-exclude-regex
option, but there is a --cov-ns-exclude-regex
just pass it a string as you do now, if you want to pass more than one then specify the option more than once
thanks!
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.