Skip to content

Instantly share code, notes, and snippets.

@viesti
Last active May 31, 2018 14:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viesti/bba5c88abbb2f6ecb914 to your computer and use it in GitHub Desktop.
Save viesti/bba5c88abbb2f6ecb914 to your computer and use it in GitHub Desktop.
Custom reporter for cljs.test
(ns myapp.test
(:require [cljs.test :as test :refer-macros [deftest is] :refer [report]]))
(enable-console-print!)
(defmethod report [:karma :begin-test-ns] [m]
(println "\nTesting with Karma" (name (:ns m))))
(defmethod report [:karma :summary] [m]
(println "All done"))
(println "custom report method:" (get-method report [:karma :begin-test-ns]))
(deftest foo
(is (= 1 1)))
(test/run-tests (test/empty-env :karma))
ClojureScript:cljs.user> (require 'myapp.test :reload)
custom report method: #<function (m){
return cljs.core.println.call(null,"\nTesting with Karma",cljs.core.name.call(null,new cljs.core.Keyword(null,"ns","ns",441598760).cljs$core$IFn$_invoke$arity$1(m)));
}>
Testing myapp.test
Ran 1 tests containing 1 assertions.
0 failures, 0 errors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment