Skip to content


Subversion checkout URL

You can clone with
Download ZIP


TestContext fails on async call #69

fredericlb opened this Issue · 5 comments

4 participants



I am not really sure if this is really a bug or if I'm making a mistake but when running this test :

(deftest ^:async empty-db-is-of-length-0
   (let [c (core/all-docs db {"include-docs" true})
         res (<! c)]
     (is= (:total_rows res) 0))

i am told that th following assert failed :
(instance? TestContext test-ctx)

however it looks to me that my code is quite close to the one concerning core.async in the README.

do you have any idea of the reason why this code snippet fails ?



Perhaps a dupe of #70. Queued, thanks.

@cemerick cemerick added this to the 0.3.2 milestone

Using the example given in here gives the same result:

(defn- timeout-helper
  [test-context delay]
  (with-test-ctx test-context
    (let [now #(.getTime (js/Date.))
        t (now)]
        (fn []
          (is (>= (now) (+ t delay)))

(deftest ^:async timeout
  (timeout-helper 2000))

printing the arguments of helper shows that context is 2000 and delay nil.

and cljs is version "0.0-2202"
cljs.test version "0.3.1"

and the code is run in phantomjs


@Verneri I found that explicitly passing in -test-ctx to timeout-helper solves the issue you're facing.

(deftest ^:async timeout
  (timeout-helper -test-ctx 2000))

Perhaps the example in the README was supposed to look like this originally?


Does this still happen under ClojureScript 2411? #70 is no longer a problem under it (and maybe other more recent compiler versions?).

@cemerick cemerick removed this from the 0.3.2 milestone

Yes it's fixed now ! Thanks

@fredericlb fredericlb closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.