test-refresh icon indicating copy to clipboard operation
test-refresh copied to clipboard

Need to respect :source-paths and :test-paths from project.clj

Open cloojure opened this issue 7 years ago • 1 comments

lein-test-refresh version 0.19.0 Lein version: Leiningen 2.7.1 on Java 1.8.0_111 Clojure 1.8.0

lein-test-refresh seems to recursively load all *.clj files instead of just those found on :source-paths and :test-paths from project.clj. This causes clashes when files that are not supposed to be in the build are attempted to be loaded/compiled.

cloojure avatar Apr 04 '17 13:04 cloojure

The current behavior exists since test-refresh calls tools.namespace to refresh and by default it refreshes everything on the classpath.

A :refresh-dirs option was added a while ago to test-refresh which allows users to specify which directories should be refreshed by specifying the arguments to tools.namespace.repl/set-refresh-dirs. There is a similar :watch-dirs option for specifying what directories should be monitored for changes.

I'm having a hard time remembering why this was done instead of looking at source/test paths by default. I'm going to have to think about this and see any pros and cons of the two approaches bubble up. The thing that first popped into my head is that the current behavior of reloading the entire classpath plays nicely with Leiningen checkouts.

In the meantime, you can work around the problem you're seeing by using :refresh-dirs. Thanks for submitting the issue.

jakemcc avatar Apr 05 '17 01:04 jakemcc