macro | since v0.0-2814 | Edit |
(async done & body)
Wraps body as a CPS function that can be returned from a test to continue asynchronously. Binds done to a function that must be invoked once and from an async context after any assertions. (deftest example-with-timeout (async done (js/setTimeout (fn [] ;; make assertions in async context... (done) ;; ...then call done ) 0)))
(defmacro async
[done & body]
`(reify
cljs.test/IAsyncTest
cljs.core/IFn
(~'-invoke [_# ~done]
~@body)))