This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-01-30
Channels
- # announcements (14)
- # aws (2)
- # beginners (167)
- # calva (25)
- # cider (124)
- # cljs-dev (2)
- # cljsrn (7)
- # clojars (2)
- # clojure (113)
- # clojure-europe (2)
- # clojure-italy (6)
- # clojure-spec (30)
- # clojure-uk (90)
- # clojurescript (20)
- # code-reviews (16)
- # cursive (28)
- # data-science (2)
- # datomic (89)
- # duct (97)
- # emacs (4)
- # figwheel-main (12)
- # fulcro (37)
- # graphql (3)
- # java (3)
- # jobs (2)
- # juxt (3)
- # kaocha (37)
- # leiningen (2)
- # luminus (2)
- # off-topic (30)
- # onyx (2)
- # pathom (3)
- # qlkit (1)
- # re-frame (7)
- # reagent (2)
- # reitit (62)
- # remote-jobs (9)
- # shadow-cljs (26)
- # tools-deps (19)
- # vim (1)
- # yada (8)
@christian767 not sure what's happening there, those patterns seem to work for me
e.g. I do touch 'test/unit/.#foo.clj'
or touch 'test/unit/#foo.clj'
and no re-run gets triggered
I would run with --no-capture-output
, and put some print statements in glob?
and wait-and-rescan?
to better see what's happening
turns out the exclude works fine, but I still get duplicate runs because of directory-level events on OSX: https://github.com/lambdaisland/kaocha/pull/63
:kaocha/tests
describes different groups of tests aka test suites.
is it possible to enable a plugin only for specific test suites (e.g. I’m writing a plugin that instruments specific fdefs), or should I as a plugin writer do extra work for people to use it that way?
If this is not possible, how do I go about implementing this? I want the user to specify in their test suite: do not instrument these functions.
@borkdude that would be up to you as the plugin author to work on the test suite level
my plugin currently looks like this:
(ns speculative.plugin
(:require [kaocha.plugin :refer [defplugin]]
[speculative.instrument :refer [instrument unstrument]]))
(defplugin speculative.plugin/instrument
(pre-run [test-plan]
(prn "TEST PLAN" test-plan)
(instrument)
test-plan)
(post-run [result]
(unstrument)
result))
pre-run
and post-run
always run before or after the complete run, i.e. all suites that are set to run. There's also pre-test
and post-test
, which will work before/after any "testable"
(and analoguous for other test types, e.g. for cucumber the nesting is suite > feature > scenario)
pre-test suite / pre-test ns / pre-test var / test var / post-test var / pre-test var 2 / test var 2 / post-test var 2 / post-test ns / post-test suite
you can compare those with the ones you find in the test plan to make sure you're only dealing with the top level ones. We really should add some stuff to kaocha.hierarchy
as well for this, so far there's only the opposite, checking if a type is a "leaf" testable, i.e. representing an actual test var.
because test suites could be of type :kaocha.type/clojure.test
, :kaocha.type/cucumber
, :kaocha.type/cljs
. You should be able to say (kaocha.hierarchy/isa? type :kaocha.type/test-suite)
but that's not there yet
but like I said you can work around that by checking that the type (or the :kaocha.testable/id)
is used at the top level of :kaocha.test-plan/tests
in the test-plan
how can I wrap the running of a test(-suite)? it seems when I do something in pre/post-test, it happens before these tests are executed. these hooks are probably only for altering the config or something?
> You should be able to say (kaocha.hierarchy/isa? type :kaocha.type/test-suite)
Yes, now I get what you mean by this. You could also just add a key :kaocha.test-suite? true
which plugins could pick up on.
FYI, I’m getting an error while running a CLJS test:
Exception in thread "main" clojure.lang.ExceptionInfo: ClojureScript Exception {:via [{:type clojure.lang.ExceptionInfo, :message "No such namespace: speculative-kaocha.no-instrument, could not locate speculative_kaocha/no_instrument.cljs, speculative_kaocha/no_instrument.cljc
if anyone wants to give it a try: https://github.com/borkdude/speculative-kaocha-plugin