jakemcc / test-refresh

Refreshes and reruns clojure.tests in your project.
393 stars 28 forks source link

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

Open cloojure opened 7 years ago

cloojure commented 7 years ago

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.

jakemcc commented 7 years ago

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.