Is there a way of getting kaocha to log each test it is running? I've hit an issue with some tests that have a subtle dependency between them, and I'm trying to debug it, but I need to know what order they are being run in.
I have this in my project root
❯ cat tests.edn
#kaocha/v1
{:plugins [:kaocha.plugin/junit-xml
:kaocha.plugin/cloverage
:kaocha.plugin.alpha/spec-test-check]
:reporter [kaocha.report/documentation]
:fail-fast? true
:kaocha.plugin.junit-xml/target-file "target/junit.xml"}
running the tests will produce a. an xml file and b. a html file which you can open up in a browser
maybe that might help?
oh yes, I think I have that too
in fact I think it was your config I used 🙂
🙂
I do think that the ordering of the tests is non-deterministic
but <shrug>
yeah, it's randomized with a seed
the error has gone away now 😄
need to be ready next time
can you provide your own seed?
I think you can
so that it's run the same way each time?
You can also disable randomization
add
:kaocha.plugin.randomize/randomize? false
to the top level map in your tests.edn
:thumbsup:
If I remember correctly, even with randomize false, your tests are still first sorted by name before they are run.
Clojure.test offers a way to specify test order via test-ns-hook
but kaocha currently https://github.com/lambdaisland/kaocha/issues/29.
Running tests in a specific order is of interest for a project I am working on that converts code blocks in docs to tests.
These code blocks sometimes rely on each other, so running in order is important.
I worked around the issue by using randomize false and generating test names that would sort appropriately.
has anyone experienced this error when running kaocha on node.js in GitHub's CI?
Exception: clojure.lang.ExceptionInfo: Failed initializing ClojureScript runtime
full stack trace: https://github.com/lilactown/autonormal/runs/2006021070?check_suite_focus=trueit's intermittent; re-running the tests typically fixes it. anecdotally I would say it fails every other time in CI. I haven't repro'd it locally yet
I haven't tried kaocha on GitHub CI myself. One thing you could try is experimenting with is the :cljs/timeout
option to a value higher than 10000 (=10 s). It's possible node.js isn't consistently ready by the time those tests run.