0.0-2496 - cljs.test - a clojure.test port

Dec 17, 2014 by David Nolen on Google Groups

The big change in this release is a port of the clojure.test namespace

  • cljs.test. It is largely compatible with clojure.test and implements enough functionality such that we could port all of the existing tests to it. It's also featureful enough to support a ClojureScript port of test.check that is underway. cljs.test is compatible with all of the optimization settings provided by the compiler including :none.

Still cljs.test may not satisfy all the patterns that people have come to expect from clojure.test so feedback (and enhancement/fix patches) is very welcome.

On the way we implemented changes to the compiler in order to make custom testing frameworks simpler to implement - this includes compiler support for :test metadata as well as introducing static vars.

ClojureScript does not have vars, however there are var patterns that are largely static in nature and useful for metaprogramming and REPL interactions. Towards this end we've implemented the var special form and introduced very restricted functionality - metadata is the primary use case.

(defn foo []) 
(meta #'foo) ;; will return the expected metadata

cljs.test is implemented on top of this functionality as well as a new namespace cljs.analyzer.api which I think macro writers will find quite useful.

Also there's a doc macro now in the cljs.repl namespace that works as expected. Patches welcome to bring all the useful bits of clojure.repl into cljs.repl.

0.0-2496

Enhancements

  • cljs.test added, mirrors clojure.test
  • New cljs.analyzer.api namespace for easier access to analysis info from macros
  • New cljs.analyzer.api namespace for easier access to analysis info from macros
  • Support :test metadata on vars
  • Support static vars
  • cljs.source-map for client side source mapping
  • expose ClojureScript :warnings build option
  • CLJS-909: Add stable api for consumers of compiler data.

Changes

  • convert all ClojureScript tests to cljs.test
  • add volatile! from Clojure 1.7
  • stateful transducers use volatile!
  • added js-debugger macro, compiles to "debugger;"
  • CLJS-892: Improve performance of compare-symbols/compare-keywords
  • CLJS-696: remove arguments usage from defrecord constructor
  • unroll partial, copy & pasted from Clojure core.clj
  • optimize clojure.string/join

Fixes

  • fix cljs.nodejs/enable-util-print!, incorrectly monkey patched cjls.core/string-print instead of setting cljs.core/*print-fn*
  • cljs.reader bug, '/ incorrectly read
  • avoid emitting the same goog.require

API Additions