New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autotest doesn't reload files with reader conditionals #339

frerom opened this Issue Nov 11, 2015 · 5 comments


None yet
5 participants

frerom commented Nov 11, 2015

I use Midje to test a ClojureScript project, this is made possible with reader conditionals. Testing a .cljc file with pure Clojure content works as it should. But as soon as you involve reader conditionals, i.e. #?(..), with the namespace declaration Midje stops watching that file. Note that using reader conditionals further down the file (that doesn't involve ns) works perfectly fine.

; This doesn't work
#?(:cljs (ns (:require [foo.baz]))
   :clj  (ns

; This doesn't work either
  #?(:cljs (:require [foo.baz])))

; This works
#?(:cljs (def foo "bar")
   :clj  (def foo "baz"))

Midje will run the tests successfully at init, the problem is that the source file isn't recompiled when changed. The file isn't listed in the print out "Loading (< namespaces >)" either.

Does anyone know what might be causing this?


This comment has been minimized.

markmandel commented Nov 21, 2015

Thanks for reporting this - just ran into exactly the same issue. +1.


This comment has been minimized.


marick commented Dec 21, 2015

Apologies for slowness, and also apologies for being ignorant of Clojurescript and conditional readers. I tried the following with Clojure 1.7:

(ns scratch.core2
  (:use midje.sweet)
  (:require [scratch.core])
  (:require [scratch.core :as generic]))

#?(:cljs (def foo "bar")
   :clj  (def foo "baz"))

When I do lein midje, I get this:

Exception in thread "main" java.lang.RuntimeException: Conditional read not allowed, compiling:(scratch/core2.clj:7:3)

What am I doing wrong?


This comment has been minimized.


marick commented Dec 21, 2015

Without the #? form, everything works:

666 $ lein midje
This is from the Midje configuration file in ${HOME}.
= Namespace scratch.t-core
Clojure version  {:major 1, :minor 7, :incremental 0, :qualifier nil}
= Namespace scratch.t-core2
= Namespace scratch.core2
All checks (1) succeeded.

This comment has been minimized.

arronmabrey commented Jan 19, 2016

@marick I believe reader conditionals are only allowed in files with the .cljc extension. The exception shows a file with .clj e.g. scratch/core2.clj

Here is a link to more resources


This comment has been minimized.

viebel commented Feb 18, 2017

I'd love to work on this issue.
@marick Could you guide me regarding how could I solve this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment