From 36627708e5df23bd4fa29269381eca67ff057bae Mon Sep 17 00:00:00 2001 From: Simon Accascina Date: Mon, 29 May 2023 12:02:09 +0200 Subject: [PATCH] Document karma's `:runner-ns` option --- docs/target-karma.adoc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/target-karma.adoc b/docs/target-karma.adoc index 76c7c9e..9e74aeb 100644 --- a/docs/target-karma.adoc +++ b/docs/target-karma.adoc @@ -35,6 +35,8 @@ The build options are: `:target`:: `:karma` `:output-to`:: A path/filename for the js file. `:ns-regexp`:: (optional) A regex to match the test namespaces, defaults to "-test$ +`:runner-ns`:: (optional) A namespace that can contain a start, stop, and init function. Defaults to +`shadow.test.karma`. So you might have something like this: @@ -82,3 +84,16 @@ LOG: 'Testing boo.sample-spec' HeadlessChrome 0.0.0 (Mac OS X 10.12.6): Executed 1 of 1 SUCCESS (0.007 secs / 0.002 secs) ``` +In case you need to perform extra initialization steps before the tests are run you can do so by supplying a custom `:runner-ns`, which might look like this: + +```cljs +(ns myapp.karma + (:require [shadow.test.karma])) + +(defn ^:export init [] + (my-extra-init-step) + (shadow.test.karma/init)) +``` + +Then in the build config add `:runner-ns myapp.karma`. +