We're updating the issue view to help you get more done. 

Calling (done) within binding in an async test corrupts bound vars

Description

In an async test, calling (done) within a (binding) corrupts bound vars.

repro/core.cljs

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 (ns repro.core (:require [clojure.string :as string] [cljs.test :refer-macros [async deftest is run-tests]])) (def ^:dynamic *foo* nil) (deftest async-binding-safe (async done (binding [*foo* {}] (is (some? *foo*))) (is (nil? *foo*)) (done))) (deftest async-binding-corruption (async done (is (nil? *foo*)) (binding [*foo* {}] (is (some? *foo*)) (done)))) (deftest async-binding-corrupt? (async done (is (nil? *foo*)) (done))) (enable-console-print!) (run-tests 'repro.core)

The first test passes as expected, and because (done) is outside the binding, foo is reverted to nil. The second test passes, but leaves foo bound. The third test fails.

Environment

OS X 10.11.5

⟩ java -version
java version "1.8.0_72"
Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)

Status

Assignee

Unassigned

Reporter

import

Labels

Approval

None

Patch

None

Affects versions

1.9.76
1.9.36
1.9.293

Priority

Major