com.github.robinlahtinen.lein-junit-xml

Instruments clojure.test in the project JVM and writes the report files.

This is the only namespace with side effects, and the only one the injected
form references by name. Everything it decides is delegated to the pure
namespaces beneath it.

Commands:
  install!   - instrument clojure.test; idempotent.
  uninstall! - restore clojure.test to how it was found.

Two touchpoints, of two different kinds, and the difference is forced by
direct linking rather than taste:

  clojure.test/report    - added defmethods, delegating to the ones they replace.
  #'clojure.test/test-ns - alter-var-root, for suite output capture and timing.

clojure.test is AOT-compiled with direct linking, so wrapping an internal
callee such as do-report is invisible to its in-namespace callers: only :pass
and :fail would ever be seen, because those originate in user code. Dispatch
through the report multimethod always happens, so adding methods sees every
event. Adding methods also leaves the multimethod intact, so a user's own
defmethod keeps working, and it composes with the robert.hooke wrapper
Leiningen installs on the same var.

install!

(install! opts)
Instruments clojure.test so that test results are written as JUnit XML.

Args:
  opts - resolved options from com.github.robinlahtinen.lein-junit-xml.impl.config/options.

Options:
  :output-dir - absolute directory the report files are written to.

Instrumenting is idempotent: calling this again leaves the existing wrappers
alone rather than stacking a second set, which under :eval-in :leiningen (where
the JVM persists across tasks) would record every event twice.

Per-run state is reset on every call, so a second invocation in the same JVM
reports its own results instead of being suppressed as already written.

Returns true when it instrumented, false when it was already instrumented.

uninstall!

(uninstall!)
Restores clojure.test to the state install! found it in.

Needed wherever the JVM outlives the run, most importantly when this plugin's
own test suite exercises the instrumentation under :eval-in-leiningen.

Returns true when it uninstalled, false when it was not installed.