<< Back to previous view

[CLJS-2899] The :testing-contexts value does not survive async macro Created: 09/Sep/18  Updated: 09/Sep/18

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Andrea Richiardi Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

It seems like the :testing-contexts is not preserved in the test environment after (or within better) a `cljs.test/async` test.

Repro:

cljs.user=> (require '[cljs.test :as test :refer-macros [deftest is testing async]])
cljs.user=> (deftest test-testing-contexts
       #_=>   (testing "not there"
       #_=>     (async done
       #_=>            (js/setTimeout #(do (is (= 0 1))
       #_=>                                (done))))))

cljs.user=> (test/test-var #'cljs.user/test-testing-contexts)
#object[Object]
cljs.user=> 
FAIL in (test-testing-contexts) (at applyHandler (<eval>:NaN:28)
expected: (= 0 1)
  actual: (not (= 0 1))

I have also inspected, using test/testing-contexts-str, the env before and after async and:

cljs.user=> (deftest test-testing-contexts
       #_=>   (testing "not there"
       #_=>     (println "outside ->" (test/testing-contexts-str))
       #_=>     (async done
       #_=>            (println "inside -> " (test/testing-contexts-str))
       #_=>            (js/setTimeout #(do (is (= 0 1))
       #_=>                                (done))))))

cljs.user=> (test/test-var #'cljs.user/test-testing-contexts)
outside -> not there
inside ->  
#object[Object]
cljs.user=> 
FAIL in (test-testing-contexts) (at applyHandler (<eval>:NaN:28)
expected: (= 0 1)
  actual: (not (= 0 1))

Generated at Thu Apr 18 16:04:25 CDT 2019 using JIRA 4.4#649-r158309.